Files
twentyone-world.github.io/js/kartograph-chroma.min.js
2022-04-26 00:05:09 +02:00

41 lines
78 KiB
JavaScript

/*!
*
* kartograph - a svg mapping library
* Copyright (C) 2011,2012 Gregor Aisch
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/(function(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL,bM,bN,bO,bP,bQ,bR,bS=function(a,b){return function(){return a.apply(b,arguments)}},bT=Object.prototype.hasOwnProperty,bU=function(a,b){function d(){this.constructor=a}for(var c in b)bT.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a};bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=bw.$K=(bF=bw.kartograph)!=null?bF:bw.kartograph={},bp.version="0.1.7",bC=!1,by=function(a){if(bC)return console.warn("kartograph ("+bp.version+"): ",a)},bq=function(a){if(bC)return console.log("kartograph ("+bp.version+"): ",a)},(bK=(bD=String.prototype).trim)==null&&(bD.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this==null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e<c;e++)if(e in b&&b[e]===a)return e;return-1}),bB=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c<d;c++)b=e[c],a["[object "+b+"]"]=b.toLowerCase();return function(b){var c;c=Object.prototype.toString.call(b);return a[c]||"object"}}(),c=function(){function a(a,b,c,d){var e;a==null&&(a=0),b==null&&(b=0),c==null&&(c=null),d==null&&(d=null),e=this,c===null?(e.xmin=Number.MAX_VALUE,e.xmax=Number.MAX_VALUE*-1):(e.xmin=e.left=a,e.xmax=e.right=a+c,e.width=c),d===null?(e.ymin=Number.MAX_VALUE,e.ymax=Number.MAX_VALUE*-1):(e.ymin=e.top=b,e.ymax=e.bottom=d+b,e.height=d);return}a.prototype.update=function(a,b){var c;b==null&&(b=a[1],a=a[0]),c=this,c.xmin=Math.min(c.xmin,a),c.ymin=Math.min(c.ymin,b),c.xmax=Math.max(c.xmax,a),c.ymax=Math.max(c.ymax,b),c.left=c.xmin,c.top=c.ymin,c.right=c.xmax,c.bottom=c.ymax,c.width=c.xmax-c.xmin,c.height=c.ymax-c.ymin;return this},a.prototype.intersects=function(a){return a.left<s.right&&a.right>s.left&&a.top<s.bottom&&a.bottom>s.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bp.BBox(d,e,c,b)},bp.BBox=c,(bL=bp.geom)==null&&(bp.geom={}),(bM=(bE=bp.geom).clipping)==null&&(bE.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,b<a.left?d|=e.LEFT:b>a.right&&(d|=e.RIGHT),c<a.top?d|=e.TOP:c>a.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bp.geom.clipping.CohenSutherland=k,A=function(){function a(a,b,d){var e,f;f=this,f.container=e=$(a),b==null&&(b=e.width()),d==null&&(d=e.height()),d===0&&(d=b*.5),f.viewport=new c(0,0,b,d),f.paper=f.createSVGLayer(),f.markers=[],f.pathById={},f.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bp.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('<div class="layer '+a+'" />'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bp.__mapCache[a]!=null?d._mapLoaded(bp.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return by(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((i=bp.__mapCache)==null&&(bp.__mapCache={}),bp.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){by("something went horribly wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bp.View.fromXML(b),f=(j=e.opts.padding)!=null?j:0,d=(k=e.opts.halign)!=null?k:"center",g=(l=e.opts.valign)!=null?l:"center",e.viewBC=new bp.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bp.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(q=h.layerIds)==null&&(h.layerIds=[]),(r=h.layers)==null&&(h.layers={}),bB(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new J(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m<o;m++)k=d[m],g.addPath(k,l);g.paths.length>0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n<p;n++)f=e[n],bB(i[f])==="function"&&h.onLayerEvent(f,i[f],b);i.tooltip!=null&&h.tooltips(i.tooltip);return h}},a.prototype.getLayer=function(a){var b;b=this,b.layers[a]==null&&by("could not find layer "+a);return b.layers[a]},a.prototype.getLayerPath=function(a,b){var c;c=this;return c.layers[a]!=null&&c.layers[a].hasPath(b)?c.layers[a].getPath(b):null},a.prototype.onLayerEvent=function(a,b,c){var d,e,f,g,h,i,j,k;f=this,f,c==null&&(c=f.layerIds[f.layerIds.length-1]),d=function(){function a(a,b,c){this.type=a,this.cb=b,this.map=c,this.handle=bS(this.handle,this)}a.prototype.handle=function(a){var b;f=this,b=f.map.pathById[a.target.getAttribute("id")];return f.cb(b.data)};return a}(),e=new d(a,b,f);if(f.layers[c]!=null){h=f.layers[c].paths,k=[];for(i=0,j=h.length;i<j;i++)g=h[i],k.push($(g.svgPath.node).bind(a,e.handle));return k}},a.prototype.addMarker=function(a){var b,c;b=this,b.markers.push(a),c=b.viewBC.project(b.viewAB.project(b.proj.project(a.lonlat.lon,a.lonlat.lat)));return a.render(c[0],c[1],b.container,b.paper)},a.prototype.clearMarkers=function(){var a,b,c,d,e;b=this,e=b.markers;for(c=0,d=e.length;c<d;c++)a=e[c],a.clear();return b.markers=[]},a.prototype.tooltips=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,h=a.content,d=(j=a.layer)!=null?j:e.layerIds[e.layerIds.length-1];if(!e.layers.hasOwnProperty(d))by('tooltips error: layer "'+d+'" not found');else{k=e.layers[d].pathsById,l=[];for(c in k)g=k[c],l.push(function(){var d,e,j,k;k=[];for(d=0,e=g.length;d<e;d++)f=g[d],$.isFunction(h)?i=h(c,f):i=h[c],b={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:(j=a.delay)!=null?j:20},content:{}},i!=null?typeof i=="string"?b.content.text=i:$.isArray(i)&&(b.content.title=i[0],b.content.text=i[1]):b.content.text="n/a",k.push($(f.svgPath.node).qtip(b));return k}());return l}},a.prototype.fadeIn=function(a){var b,c,d,e,f,g,h,i,j,k,l;a==null&&(a={}),f=this,e=(i=a.layer)!=null?i:f.layerIds[f.layerIds.length-1],c=(j=a.duration)!=null?j:500,k=f.layers[e].pathsById,l=[];for(d in k)h=k[d],l.push(function(){var a,d,e;e=[];for(a=0,d=h.length;a<d;a++)g=h[a],bB(c)==="function"?b=c(g.data):b=c,g.svgPath.attr("opacity",0),e.push(g.svgPath.animate({opacity:1},b));return e}());return l},a.prototype.loadCoastline=function(){var a;a=this;return $.ajax({url:"coastline.json",success:a.renderCoastline,context:a})},a.prototype.resize=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;g=this,c=g.container,a==null&&(a=c.width()),b==null&&(b=c.height()),g.viewport=k=new bp.BBox(0,0,a,b),g.paper.setSize(k.width,k.height),k=g.viewport,h=(o=g.opts.padding)!=null?o:0,d=(p=g.opts.halign)!=null?p:"center",j=(q=g.opts.valign)!=null?q:"center",l=g.opts.zoom,g.viewBC=new bp.View(g.viewAB.asBBox(),k.width*l,k.height*l,h,d,j),r=g.layers;for(e in r)f=r[e],f.setView(g.viewBC);if(g.symbolGroups!=null){s=g.symbolGroups;for(m=0,n=s.length;m<n;m++)i=s[m],i.onResize()}},a.prototype.lonlat2xy=function(a){var b,c;c=this,a.length===2&&(a=new bp.LonLat(a[0],a[1])),a.length===3&&(a=new bp.LonLat(a[0],a[1],a[2])),b=c.proj.project(a.lon,a.lat,a.alt);return c.viewBC.project(c.viewAB.project(b))},a.prototype.showZoomControls=function(){var a;a=this,a.zc=new Q(a);return a},a.prototype.addSymbolGroup=function(a){var b,c;b=this,(c=b.symbolGroups)==null&&(b.symbolGroups=[]);return b.symbolGroups.push(a)},a.prototype.clear=function(){var a,b,c,d,e,f;b=this;if(b.layers!=null){for(a in b.layers)b.layers[a].remove();b.layers={},b.layerIds=[]}if(b.symbolGroups!=null){f=b.symbolGroups;for(d=0,e=f.length;d<e;d++)c=f[d],c.remove();return b.symbolGroups=[]}},a.prototype.loadStyles=function(a,b){var c;c=this;if($.browser.msie)return $.ajax({url:a,dataType:"text",success:function(a){c.styles=bp.parsecss(a);return b()},error:function(b,c,d){return by("error while loading "+a,b,c,d)}});$("body").append('<link rel="stylesheet" href="'+a+'" />');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(n=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(o=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,p=f.split(",");for(j=0,l=p.length;j<l;j++){i=p[j],f=i.split(" "),f=f[f.length-1],f=f.split(":");if(f.length>1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],q=e._regardStyles;for(k=0,m=q.length;k<m;k++)d=q[k],g[d]!=null&&a.attr(d,g[d])}}return a};return a}(),bp.Kartograph=A,bp.map=function(a,b,c){return new A(a,b,c)},bp.__mapCache={},bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=(bN=bw.kartograph)!=null?bN:bw.kartograph={},H=function(){function a(a,b,c){c==null&&(c=0),this.lon=Number(a),this.lat=Number(b),this.alt=Number(c)}a.prototype.distance=function(a){var b,c,d,e,f,g,h,i,j;j=this,b=6371,g=Math.PI/180,e=(a.lat-j.lat)*g,f=(a.lon-j.lon)*g,h=j.lat*g,i=a.lat*g,c=Math.sin(e/2)*Math.sin(e/2)+Math.sin(f/2)*Math.sin(f/2)*Math.cos(h)*Math.cos(i),d=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return b*d};return a}(),D=function(){function a(b,c,d){d==null&&(d=0),a.__super__.constructor.call(this,c,b,d)}bU(a,H);return a}(),bp.LonLat=H,bp.LatLon=D,J=function(){function a(a,b,c,d){var e;e=this,e.id=a,e.path_id=b,e.paper=c.paper,e.view=c.viewBC,e.map=c,e.filter=d}a.prototype.addPath=function(a,b){var c,d,e,f,g,h,i;d=this,(g=d.paths)==null&&(d.paths=[]),c=new K(a,d.id,d.map,b);if(bB(d.filter)==="function"&&d.filter(c.data)===!1)c.remove();else{d.paths.push(c);if(d.path_id!=null){(h=d.pathsById)==null&&(d.pathsById={}),(i=(e=d.pathsById)[f=c.data[d.path_id]])==null&&(e[f]=[]);return d.pathsById[c.data[d.path_id]].push(c)}}},a.prototype.hasPath=function(a){var b;b=this;return b.pathsById!=null&&b.pathsById[a]!=null},a.prototype.getPathsData=function(){var a,b,c,d,e,f;a=this,c=[],f=a.paths;for(d=0,e=f.length;d<e;d++)b=f[d],c.push(b.data);return c},a.prototype.getPath=function(a){var b;b=this;if(b.hasPath(a))return b.pathsById[a][0];throw"path "+a+" not found"},a.prototype.setView=function(a){var b,c,d,e,f,g;b=this,f=b.paths,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(c.setView(a));return g},a.prototype.remove=function(){var a,b,c,d,e,f;a=this,e=a.paths,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.remove());return f};return a}(),br=0,K=function(){function a(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p;h=this,i=c.paper,n=c.viewBC,h.path=j=bp.geom.Path.fromSVG(a),h.vpath=n.projectPath(j),h.svgPath=h.vpath.toSVG(i),c.styles==null?h.svgPath.node.setAttribute("class",b):c.applyStyles(h.svgPath,b),l="path_"+br++,h.svgPath.node.setAttribute("id",l),c.pathById[l]=h,f={};for(g=0,p=a.attributes.length-1;0<=p?g<=p:g>=p;0<=p?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(m=e.value,o=Number(m),m.trim()!==""&&o===m&&!isNaN(o)&&(m=o),f[e.name.substr(5)]=m);h.data=f,bB(d)==="string"?k=d:bB(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=(bO=bw.kartograph)!=null?bO:bw.kartograph={},bp.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=bs(a),j=a.split("`b%");for(h=0,i=j.length;h<i;h++){c=j[h],c=c.split("%b`");if(c.length<2)continue;c[0]=bv(c[0]),e=bu(c[1]);if(f[c[0]]!=null)for(d in e)g=e[d],f[c[0]][d]=g;else f[c[0]]=e}if(bB(b)==="function")b(f);else return f},bt={},bu=function(a){var b,c,d,e,f,g;d=bt[a].replace(/^{|}$/g,""),d=bs(d),c={},g=d.split(";");for(e=0,f=g.length;e<f;e++){b=g[e],b=b.split(":");if(b.length<2)continue;c[bv(b[0])]=bv(b.slice(1).join(":"))}return c},X=/{[^{}]*}/,Z=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/,Y=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g,_=/%\w`(\d+)`\w%/,bx=0,bs=function(a,b){var c,d,e;a=a.replace(Y,function(a,b){var c;if(!b)return"";c="%s`"+ ++bx+"`s%",bt[bx]=b.replace(/^\\/,"");return c}),c=b?Z:X;while(d=c.exec(a))e="%b`"+ ++bx+"`b%",bt[bx]=d[0],a=a.replace(c,e);return a},bv=function(a){var b;if(a==null)return a;while(b=_.exec(a))a=a.replace(_,bt[b[1]]);return a.trim()},bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=(bP=bw.kartograph)!=null?bP:bw.kartograph={},(bQ=bp.geom)==null&&(bp.geom={}),R=function(){function a(a,b,c){var d;c==null&&(c=!0),d=this,d.type=a,d.contours=b,d.closed=c}a.prototype.clipToBBox=function(a){throw"path clipping is not implemented yet"},a.prototype.toSVG=function(a){var b;b=this.svgString();return a.path(b)},a.prototype.svgString=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;d=this,e="",c=d.closed?"Z M":"M",m=d.contours;for(h=0,j=m.length;h<j;h++){a=m[h],b=!0,e+=e===""?"M":c;for(i=0,k=a.length;i<k;i++)l=a[i],f=l[0],g=l[1],b||(e+="L"),e+=f+","+g,b=!1}d.closed&&(e+="Z");return e},a.prototype.area=function(){var a,b,c,d,e,f,g,h;d=this;if(d.areas!=null)return d._area;d.areas=[],d._area=0,h=d.contours;for(e=0,f=h.length;e<f;e++){b=h[e],a=0;for(c=0,g=b.length-2;0<=g?c<=g:c>=g;0<=g?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;m=this;if(m._centroid!=null)return m._centroid;b=m.area(),d=e=0;for(h=0,w=m.contours.length-1;0<=w?h<=w:h>=w;0<=w?h++:h--){c=m.contours[h],a=m.areas[h],r=s=0,k=c.length,t=[],p=0;for(i=0,u=k-1;0<=u?i<=u:i>=u;0<=u?i++:i--)n=c[i],o=c[(i+1)%k],f=o[0]-n[0],g=o[1]-n[1],l=Math.sqrt(f*f+g*g),t.push(l),p+=l;for(i=0,v=k-1;0<=v?i<=v:i>=v;0<=v?i++:i--)n=c[i],o=c[(i+1)%k],q=t[i]/p,r+=q*n[0],s+=q*n[1];j=a/b,d+=r*j,e+=s*j}m._centroid=[d,e];return m._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(a<c[0]||a>c[2]||b<c[1]||b>c[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(bz(d,[a,b]))return!0}return!1};return a}(),bp.geom.Path=R,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bU(a,R),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bp.geom.Circle=j,R.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),v=h.split(l);for(p=0,r=v.length;p<r;p++){d=v[p],c=[];if(d!==""){t=d.split("L");for(q=0,s=t.length;q<s;q++)i=t[q],u=i.split(","),n=u[0],o=u[1],c.push([Number(n),Number(o)]);e.push(c)}}k=new bp.geom.Path(m,e,b)}else m==="circle"&&(f=a.getAttribute("cx"),g=a.getAttribute("cy"),j=a.getAttribute("r"),k=new bp.geom.Circle(f,g,j));return k},E=function(){function a(a){this.points=a}a.prototype.clipToBBox=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;l=this,c=(new bp.geom.clipping.CohenSutherland).clip,k=[],f=[],e=!1;for(d=0,t=l.points.length-2;0<=t?d<=t:d>=t;0<=t?d++:d--){q=l.points[d],g=q[0],h=q[1],r=l.points[d+1],i=r[0],j=r[1];try{s=c(b,g,h,i,j),m=s[0],o=s[1],n=s[2],p=s[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],h=b.points;for(e=0,f=h.length;e<f;e++)g=h[e],c=g[0],d=g[1],a.push(c+","+d);return"M"+a.join("L")};return a}(),bp.geom.Line=E,bz=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;h=Math.PI,d=Math.atan2,k=h*2,g=a.length,c=0;for(f=0,p=g-1;0<=p?f<=p:f>=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=(bR=bw.kartograph)!=null?bR:bw.kartograph={},bA=bp.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},T=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.parameters=[],a.title="Projection",a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j<k;j++)l=a[j],e=l[0],d=l[1],g=this._visible(e,d),g&&(c=!1),m=this.project(e,d),h=m[0],i=m[1],!g&&b?f.push(this._truncate(h,i)):f.push([h,i]);return c?null:[f]},a.prototype.sea=function(){var a,b,c,d,e,f,g,h,i,j;f=this,e=f.project.bind(this),d=[],a=f.lon0,f.lon0=0;for(c=-180;c<=180;c++)d.push(e(c,f.maxLat));for(b=g=f.maxLat,h=f.minLat;g<=h?b<=h:b>=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bp.BBox;for(e=0,f=d.length;e<f;e++)c=d[e],a.update(c[0],c[1]);return a},a.prototype.toString=function(){var a;a=this;return"[Proj: "+a.name+"]"};return a}(),T.fromXML=function(a){var b,c,d,e,f,g;d=a.getAttribute("id"),e={};for(c=0,g=a.attributes.length-1;0<=g?c<=g:c>=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bp.proj[d](e),f.name=d;return f},bp.Proj=T,n=function(){function a(b){var c,d,e;b==null&&(b={}),c=this,c.flip=Number((d=b.flip)!=null?d:0),c.flip===1&&(b.lon0=(e=-b.lon0)!=null?e:0),a.__super__.constructor.call(this,b)}bU(a,T),a.parameters=["lon0","flip"],a.title="Cylindrical Projection",a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,n),a.title="Equirectangular Projection",a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bA.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bU(a,n),a.parameters=["lon0","lat1","flip"],a.title="Cylindrical Equal Area",a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bA.cea=h,t=function(){function a(b){b.lat1=45,a.__super__.constructor.call(this,b)}bU(a,h),a.title="Gall-Peters Projection",a.parameters=["lon0","flip"];return a}(),bA.gallpeters=t,x=function(){function a(b){b.lat1=37.7,a.__super__.constructor.call(this,b)}bU(a,h),a.title="Hobo-Dyer Projection",a.parameters=["lon0","flip"];return a}(),bA.hobodyer=x,e=function(){function a(b){b.lat1=30,a.__super__.constructor.call(this,b)}bU(a,h),a.title="Behrmann Projection",a.parameters=["lon0","flip"];return a}(),bA.behrmann=e,d=function(){function a(b){b.lat1=50,a.__super__.constructor.call(this,b)}bU(a,h),a.title="Balthasart Projection",a.parameters=["lon0","flip"];return a}(),bA.balthasart=d,L=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bU(a,n),a.title="Mercator Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bA.mercator=L,V=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,n),a.title="Pseudo-Cylindrical Projection";return a}(),N=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bU(a,V),a.title="Natural Earth Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bA.naturalearth=N,ba=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bU(a,V),a.title="Robinson Projection",a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bA.robinson=ba,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bU(a,V),a.title="Eckert IV Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)<h.EPS)break;e-=1}e===0?(k=h.C_x*f,l=g<0?-h.C_y:h.C_y):(k=h.C_x*f*(1+Math.cos(g)),l=h.C_y*Math.sin(g));return[k,l]};return a}(),bA.eckert4=o,bd=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,V),a.title="Sinusoidal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h;d=this,h=d.ll(a,b),a=h[0],b=h[1],c=d.rad(d.clon(a)),e=d.rad(b*-1),f=1032*c*Math.cos(e),g=1032*e;return[f,g]};return a}(),bA.sinusoidal=bd,M=function(){function a(b,c,d,e,f){var g,h,i,j;c==null&&(c=1.5707963267948966),d==null&&(d=null),e==null&&(e=null),f==null&&(f=null),a.__super__.constructor.call(this,b),g=this,g.MAX_ITER=10,g.TOLERANCE=1e-7,c!=null?(h=c+c,j=Math.sin(c),i=Math.sqrt(Math.PI*2*j/(h+Math.sin(h))),g.cx=2*i/Math.PI,g.cy=i/j,g.cp=h+Math.sin(h)):d!=null&&e!=null&&typeof cz!="undefined"&&cz!==null?(g.cx=d,g.cy=e,g.cp=f):by("kartograph.proj.Mollweide: either p or cx,cy,cp must be defined")}bU(a,V),a.title="Mollweide Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],g=Math,c=g.abs,f=h.rad(h.clon(a)),i=h.rad(b),e=h.cp*g.sin(i),d=h.MAX_ITER;while(d!==0){j=(i+g.sin(i)-e)/(1+g.cos(i)),i-=j;if(c(j)<h.TOLERANCE)break;d-=1}d===0?i=i>=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bA.mollweide=M,bk=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bU(a,M),a.title="Wagner IV Projection";return a}(),bA.wagner4=bk,bl=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bU(a,M),a.title="Wagner V Projection";return a}(),bA.wagner5=bl,I=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bU(c,V),b=-89,a=89,c.parameters=["lon0","lat0","flip"],c.title="Loximuthal Projection (equidistant)",c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bA.loximuthal=I,i=function(){function f(){f.__super__.constructor.apply(this,arguments)}var a,b,c,d,e;bU(f,V),f.title="Canters Modified Sinusoidal I",f.parameters=["lon0"],a=1.1966,b=-0.129,c=3*b,d=-0.0076,e=5*d,f.prototype.project=function(f,g){var h,i,j,k,l,m;h=this,m=h.ll(f,g),f=m[0],g=m[1],f=h.rad(h.clon(f)),g=h.rad(g),k=g*g,l=k*k,i=1e3*f*Math.cos(g)/(a+c*k+e*l),j=1e3*g*(a+b*k+d*l);return[i,j*-1]};return f}(),bA.canters1=i,w=function(){function n(a){n.__super__.constructor.call(this,a)}var a,b,c,d,e,f,g,h,i,j,k,l,m;bU(n,V),n.title="Hatano Projection",g=20,c=1e-7,h=1.000001,a=2.67595,b=2.43763,i=.3736990601468637,j=.4102345310814193,e=1.75859,f=1.93052,l=.5686373742600607,m=.5179951515653813,d=.85,k=1.1764705882352942,n.prototype.project=function(h,i){var j,k,l,m,n,o,p,q,r;m=this,r=m.ll(h,i),h=r[0],i=r[1],l=m.rad(m.clon(h)),n=m.rad(i),j=Math.sin(n)*(n<0?b:a);for(k=g;k>=1;k+=-1){o=(n+Math.sin(n)-j)/(1+Math.cos(n)),n-=o;if(Math.abs(o)<c)break}p=1e3*d*l*Math.cos(n*=.5),q=1e3*Math.sin(n)*(n<0?f:e);return[p,q*-1]};return n}(),bA.hatano=w,v=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.lat1=41.737,c.p1=new M,c.p0=new bd}bU(a,V),a.title="Goode Homolosine Projection",a.parameters=["lon0"],a.prototype.project=function(a,b){var c,d;c=this,d=c.ll(a,b),a=d[0],b=d[1],a=c.clon(a);return Math.abs(b)>c.lat1?c.p1.project(a,b):c.p0.project(a,b)};return a}(),bA.goodehomolosine=v,O=function(){function b(a){b.__super__.constructor.call(this,a),this.r=this.HALFPI*100}var a;bU(b,V),b.title="Nicolosi Globular Projection",b.parameters=["lon0"],a=1e-10,b.prototype._visible=function(a,b){var c;c=this,a=c.clon(a);return a>-90&&a<90},b.prototype.project=function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;h=this,p=h.ll(b,c),b=p[0],c=p[1],f=h.rad(h.clon(b)),j=h.rad(c),Math.abs(f)<a?(n=0,o=j):Math.abs(j)<a?(n=f,o=0):Math.abs(Math.abs(f)-h.HALFPI)<a?(n=f*Math.cos(j),o=h.HALFPI*Math.sin(j)):Math.abs(Math.abs(j)-h.HALFPI)<a?(n=0,o=j):(m=h.HALFPI/f-f/h.HALFPI,d=j/h.HALFPI,l=Math.sin(j),e=(1-d*d)/(l-d),k=m/e,k*=k,g=(m*l/e-.5*m)/(1+k),i=(l/k+.5*e)/(1+1/k),n=Math.cos(j),n=Math.sqrt(g*g+n*n/(1+k)),n=h.HALFPI*(g+(f<0?-n:n)),o=Math.sqrt(i*i-(l*l/k+e*l-1)/(1+1/k)),o=h.HALFPI*(i+(j<0?o:-o)));return[n*100,o*-100]},b.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([a.cos(this.rad(c))*d,a.sin(this.rad(c))*d]);return b},b.prototype.world_bbox=function(){var a;a=this.r;return new bp.BBox(-a,-a,a*2,a*2)};return b}(),bA.nicolosi=O,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bU(a,T),a.parameters=["lon0","lat0"],a.title="Azimuthal Projection",a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bp.BBox(0,0,a*2,a*2)};return a}(),P=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,b),a.title="Orthographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bA.ortho=P,B=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bU(a,b),a.title="Lambert Azimuthal Equal-Area Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bA.laea=B,bf=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,b),a.title="Stereographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.
lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bA.stereo=bf,bb=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bU(a,b),a.parameters=["lon0","lat0","tilt","dist","up"],a.title="Satellite Projection",a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a,b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bA.satellite=bb,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,b),a.title="Equidistant Azimuthal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;i=this,j=i.rad(b),g=i.rad(a),h=Math,k=h.sin,d=h.cos,e=k(this.phi0)*k(j)+d(this.phi0)*d(j)*d(g-this.lam0),c=h.acos(e),f=.325*c/k(c),m=this.r*f*d(j)*k(g-this.lam0),o=-this.r*f*(d(this.phi0)*k(j)-k(this.phi0)*d(j)*d(g-this.lam0)),l=this.r+m,n=this.r+o;return[l,n]},a.prototype._visible=function(a,b){return!0};return a}(),bA.equi=p,a=function(){function b(a){var c;c=this,a.lat0=0,b.__super__.constructor.call(this,a),c.lam0=0}var a;bU(b,V),b.title="Aitoff Projection",b.parameters=["lon0"],a=.6366197723675814,b.prototype.project=function(b,c){var d,e,f,g,h,i,j,k;g=this,k=g.ll(b,c),b=k[0],c=k[1],b=g.clon(b),f=g.rad(b),h=g.rad(c),d=.5*f,e=Math.acos(Math.cos(h)*Math.cos(d)),e!==0?(j=1/Math.sin(e),i=2*e*Math.cos(h)*Math.sin(d)*j,j*=e*Math.sin(h)):i=j=0,g.winkel&&(i=(i+f*a)*.5,j=(j+h)*.5);return[i*1e3,j*-1e3]},b.prototype._visible=function(a,b){return!0};return b}(),bA.aitoff=a,bm=function(){function b(a){b.__super__.constructor.call(this,a),this.winkel=!0}bU(b,a),b.title="Winkel Tripel Projection";return b}(),bA.winkel3=bm,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bU(a,T),a.title="Conic Projection",a.parameters=["lon0","lat0","lat1","lat2"],a.prototype._visible=function(a,b){var c;c=this;return b>c.minLat&&b<c.maxLat},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),C=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bq=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bq(f/e(k.phi2))/bq(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bU(a,l),a.title="Lambert Conformal Conic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bq=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*(l.rho0-k*d(f));return[o,p*-1]};return a}(),bA.lcc=C,U=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,l);return a}(),bj=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k<m;k++){g=o[k],c=[];for(l=0,n=g.length;l<n;l++)p=g[l],i=p[0],j=p[1],q=e.project(i,j),i=q[0],j=q[1],c.push([i,j]),b[0]=Math.min(b[0],i),b[1]=Math.min(b[1],j),b[2]=Math.max(b[2],i),b[3]=Math.max(b[3],j);d.push(c)}f=new bp.geom.Path(a.type,d,a.closed),f._bbox=b;return f}if(a.type==="circle"){r=e.project(a.x,a.y),i=r[0],j=r[1],h=a.r*e.scale;return new bp.geom.Circle(i,j,h)}},a.prototype.asBBox=function(){var a;a=this;return new bp.BBox(0,0,a.width,a.height)};return a}(),bj.fromXML=function(a){var b,d,e,f,g;g=Number(a.getAttribute("w")),e=Number(a.getAttribute("h")),f=Number(a.getAttribute("padding")),d=a.getElementsByTagName("bbox")[0],b=c.fromXML(d);return new bp.View(b,g,e,f)},bw=typeof exports!="undefined"&&exports!==null?exports:this,(bG=bw.kartograph)==null&&(bw.kartograph={}),bw.kartograph.View=bj,bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=bw.$K=(bH=bw.kartograph)!=null?bH:bw.kartograph={},bp.Kartograph.prototype.choropleth=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;l=this,k=(w=a.layer)!=null?w:l.layerIds[l.layerIds.length-1];if(!l.layers.hasOwnProperty(k))by('choropleth error: layer "'+layer_ihad+'" not found');else{e=a.data,f=a.value,g=a.key,d=a.colors,o={};if(g!=null&&bB(e)==="array")for(s=0,u=e.length;s<u;s++)r=e[s],j=r[g],o[String(j)]=r;else if(bB(e)==="object")for(j in e)r=e[j],o[String(j)]=r;x=l.layers[k].pathsById;for(j in x){p=x[j];for(t=0,v=p.length;t<v;t++)n=p[t],e==null&&(q=n.data),bB(e)==="function"?q=e(n.data):q=(y=o[j])!=null?y:null,c=d(q,n.data),a.duration!=null&&a.duration>0?(bB(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?bB(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null,n.data),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},bp.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;r=this,q=(J=a.layer)!=null?J:r.layerIds[r.layerIds.length-1];if(!r.layers.hasOwnProperty(q))by('dotgrid error: layer "'+q+'" not found');else{p=r.layers[q],c=a.data,d=a.value,e=a.key,t={};if(e!=null&&bB(c)==="array")for(B=0,F=c.length;B<F;B++)w=c[B],o=w[e],t[String(o)]=w;else for(o in c)w=c[o],t[String(o)]=w;i=(K=a.style)!=null?K:{fill:"black",stroke:"none"},y=a.size,n=(L=a.gridsize)!=null?L:15,h=(M=p.dotgrid)!=null?M:p.dotgrid={gridsize:n,grid:[]};if(h.gridsize!==n){N=h.grid;for(C=0,G=N.length;C<G;C++)m=N[C],m.shape!=null&&(m.shape.remove(),m.shape=null)}if(n>0){if(h.grid.length===0)for(z=0,O=r.viewport.width;0<=O?z<=O:z>=O;z+=n)for(A=0,P=r.viewport.height;0<=P?A<=P:A>=P;A+=n){m={x:z+(Math.random()-.5)*n*.2,y:A+(Math.random()-.5)*n*.2,pathid:!1},l=!1,Q=p.pathsById;for(o in Q){u=Q[o];for(D=0,H=u.length;D<H;D++){s=u[D];if(s.vpath.isInside(m.x,m.y)){l=!0,v=(R=t[o])!=null?R:null,x=y(v),m.pathid=o,m.shape=p.paper.circle(m.x,m.y,1);break}}if(l)break}h.grid.push(m)}S=h.grid;for(E=0,I=S.length;E<I;E++)m=S[E],m.pathid&&(v=(T=t[m.pathid])!=null?T:null,x=y(v),k=(U=a.duration)!=null?U:0,f=(V=a.delay)!=null?V:0,bB(f)==="function"?g=f(v):g=f,k>0&&Raphael.svg?(b=Raphael.animation({r:x*.5},k),m.shape.animate(b.delay(g))):m.shape.attr({r:x*.5}),bB(i)==="function"?j=i(v):j=i,m.shape.attr(j))}}},bo=(bI=bp.filter)!=null?bI:bp.filter={},bo.__knownFilter={},bo.__patternFills=0,J.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a},bp.Kartograph.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bp.filter[b]!=null)e=(new bp.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},J.prototype.applyFilter=function(a){var b;b=this;return $("."+b.id,b.paper.canvas).attr({filter:"url(#"+a+")"})},J.prototype.applyTexture=function(a,b,c,d){var e,f,g,h,i,j;d==null&&(d="#fff"),f=this,bo.__patternFills+=1,i=f.paths,j=[];for(g=0,h=i.length;g<h;g++)e=i[g],j.push(e.svgPath.attr({fill:"url("+a+")"}));return j},r=function(){function a(a){this.params=a!=null?a:{}}a.prototype.getFilter=function(a){var b,c;c=this,b=c.SVG("filter",{id:a}),c.buildFilter(b);return b},a.prototype._getFilter=function(){throw"not implemented"},a.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a};return a}(),f=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,r),a.prototype.buildFilter=function(a){var b,c,d;d=this,b=d.SVG,c=b("feGaussianBlur",{stdDeviation:d.params.size||4,result:"blur"});return a.appendChild(c)};return a}(),bo.blur=f,u=function(){function a(){a.__super__.constructor.apply(this,arguments)}bU(a,r),a.prototype.buildFilter=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;g=this,c=(j=g.params.blur)!=null?j:4,i=(k=g.params.strength)!=null?k:1,d=(l=g.params.color)!=null?l:"#D1BEB0",typeof d=="string"&&(d=chroma.hex(d)),h=d.rgb,e=(m=g.params.inner)!=null?m:!1,f=(n=g.params.knockout)!=null?n:!1,b=(o=g.params.alpha)!=null?o:1,e?g.innerGlow(a,c,i,h,b,f):g.outerGlow(a,c,i,h,b,f)},a.prototype.outerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"mask"}),a.appendChild(j),c>0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,bq("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 1",result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bo.glow=u,bw=typeof exports!="undefined"&&exports!==null?exports:this,bp=bw.$K=(bJ=bw.kartograph)!=null?bJ:bw.kartograph={},bp.Kartograph.prototype.addGeoPath=function(a,b,c){var d,e,f;b==null&&(b=[]),c==null&&(c=""),d=this,f=d.getGeoPathStr(a,b),e=d.paper.path(f),c!==""&&e.node.setAttribute("class",c);return e},bp.Kartograph.prototype.getGeoPathStr=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=[]),e=this,type(b)==="string"&&(b=b.split("")),b.length===0&&b.push("M"),f="";for(d in a){g=a[d],c=(i=b[d])!=null?i:"L",h=e.lonlat2xy(g);if(isNaN(h[0])||isNaN(h[1]))continue;f+=c+h[0]+","+h[1]}return f},Q=function(){function a(a){this.zoomOut=bS(this.zoomOut,this),this.zoomIn=bS(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('<div class="'+a+'" />');for(e=0,f=b.length;e<f;e++)c=b[e],d.append(c);return d},d=function(a){return $(a.target).addClass("md")},f=function(a){return $(a.target).removeClass("md")},i=c("plus"),i.mousedown(d),i.mouseup(f),i.click(e.zoomIn),h=c("minus"),h.mousedown(d),h.mouseup(f),h.click(e.zoomOut),g=c("zoom-control",[i,h]),b.append(g)}a.prototype.zoomIn=function(a){var b;b=this,b.map.opts.zoom+=1;return b.map.resize()},a.prototype.zoomOut=function(a){var b;b=this,b.map.opts.zoom-=1,b.map.opts.zoom<1&&(b.map.opts.zoom=1);return b.map.resize()};return a}(),bc=function(){function a(a,b,c){var d,e,f,g;a==null&&(a=[0,1]),b==null&&(b=null),c==null&&(c=null),this.scale=bS(this.scale,this),e=this,g=[];for(d in a){if(bB(c)==="function"&&c(a[d])===!1)continue;b!=null?bB(b)==="function"?f=b(a[d]):f=a[d][b]:f=a[d],isNaN(f)||g.push(f)}g=g.sort(function(a,b){return a-b}),e.values=g}a.prototype.scale=function(a){return a};return a}(),F=function(){function a(){this.scale=bS(this.scale,this),a.__super__.constructor.apply(this,arguments)}bU(a,bc),a.prototype.scale=function(a){var b,c;b=this,c=b.values;return(a-c[0])/(c[c.length-1]-c[0])};return a}(),G=function(){function a(){this.scale=bS(this.scale,this),a.__super__.constructor.apply(this,arguments)}bU(a,bc),a.prototype.scale=function(a){var b,c;b=this,c=b.values,bq=Math.log;return(bq(a)-bq(c[0]))/(bq(c[c.length-1])-bq(c[0]))};return a}(),W=function(){function a(){this.scale=bS(this.scale,this),a.__super__.constructor.apply(this,arguments)}bU(a,bc),a.prototype.scale=function(a){var b,c,d,e,f,g;d=this,g=d.values,c=g.length-1;for(b in g){f=g[Number(b)],e=g[Number(b)+1];if(a===f)return b/c;if(b<c&&a>f&&a<e)return b/c+(a-f)/(e-f)}};return a}(),bp.scale={},bp.scale.identity=function(a){return(new bc(domain,prop,bo)).scale},bp.scale.linear=function(a,b,c){return(new F(a,b,c)).scale},bp.scale.log=function(a,b,c){return(new G(a,b,c)).scale},bp.scale.quantile=function(a,b,c){return(new W(a,b,c)).scale},bh=function(){function b(b){a=this,a.location=b.location,a.data=b.data,a.map=b.map,a.layers=b.layers,a.x=b.x,a.y=b.y}var a;a=null,b.prototype.init=function(){return a},b.prototype.overlaps=function(a){return!1},b.prototype.update=function(b){return a},b.prototype.nodes=function(){return[]},b.prototype.clear=function(){return a};return b}(),bp.Symbol=bh,bi=function(){function b(c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=this;a=this,n=["data","location","type","map"],l=["filter","tooltip","layout","group","click"];for(p=0,t=n.length;p<t;p++){m=n[p];if(c[m]!=null)a[m]=c[m];else throw"SymbolGroup: missing argument '"+m+"'"}for(q=0,u=l.length;q<u;q++)m=l[q],c[m]!=null&&(a[m]=c[m]);d=a.type;if(d==null)by("could not resolve symbol type",a.type);else{D=d.props;for(r=0,v=D.length;r<v;r++)m=D[r],c[m]!=null&&(a[m]=c[m]);a.layers={mapcanvas:a.map.paper},E=d.layers;for(s=0,w=E.length;s<w;s++)h=E[s],j=b._layerid++,g="sl_"+j,h.type==="svg"?i=a.map.createSVGLayer(g):h.type==="html"&&(i=a.map.createHTMLLayer(g)),a.layers[h.id]=i;a.symbols=[];for(f in a.data)e=a.data[f],bB(a.filter)==="function"?a.filter(e)&&a.addSymbol(e):a.addSymbol(e);a.layoutSymbols(),F=a.symbols;for(A=0,x=F.length;A<x;A++)o=F[A],o.render();bB(a.tooltip)==="function"&&a.initTooltips();if(bB(a.click)==="function"){G=a.symbols;for(B=0,y=G.length;B<y;B++){o=G[B],H=o.nodes();for(C=0,z=H.length;C<z;C++)k=H[C],k.symbol=o,$(k).click(function(b){b.stopPropagation();return a.click(b.target.symbol.data)})}}a.map.addSymbolGroup(a)}}var a;a=null,b.prototype.addSymbol=function(b){var c,d,e,f,g,h,i,j;a=this,c=a.type,d=a._evaluate(a.location,b),bB(d)==="array"&&(d=new bp.LonLat(d[0],d[1])),f={layers:a.layers,location:d,data:b,map:a.map},j=c.props;for(h=0,i=j.length;h<i;h++)e=j[h],a[e]!=null&&(f[e]=a._evaluate(a[e],b));g=new c(f),a.symbols.push(g);return g},b.prototype._evaluate=function(a,b){var c;return bB(a)==="function"?c=a(b):c=a},b.prototype.layoutSymbols=function(){var b,c,d,e,f,g,h,i,j,k;j=a.symbols;for(h=0,i=j.length;h<i;h++){f=j[h],c=f.location;if(bB(c)==="string"){k=c.split("."),b=k[0],e=k[1],d=a.map.getLayerPath(b,e);if(d!=null)g=a.map.viewBC.project(d.path.centroid());else{by("could not find layer path "+b+"."+e);continue}}else g=a.map.lonlat2xy(c);f.x=g[0],f.y=g[1]}if(a.layout==="group")return a.groupLayout()},b.prototype.groupLayout=function(){var b,c;a=this,(c=a.gsymbols)==null&&(a.gsymbols=[]);return b=!0},b.prototype.initTooltips=function(){var b,c,d,e,f,g,h,i,j,k,l;a=this,e=a.tooltip,k=a.symbols;for(g=0,i=k.length;g<i;g++){d=k[g],b={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:20},content:{}},f=e(d.data),bB(f)==="string"?b.content.text=f:bB(f)==="array"&&(b.content.title=f[0],b.content.text=f[1]),l=d.nodes();for(h=0,j=l.length;h<j;h++)c=l[h],$(c).qtip(b)}},b.prototype.remove=function(){var b,c,d,e,f,g,h,i;a=this,g=a.symbols;for(e=0,f=g.length;e<f;e++){d=g[e];try{d.clear()}catch(j){by("error: symbolgroup.remove")}}h=a.layers,i=[];for(b in h)c=h[b],b!=="mapcanvas"?i.push(c.remove()):i.push(void 0);return i},b.prototype.onResize=function(){var b,c,d,e,f;a=this,a.layoutSymbols(),e=a.symbols,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.update());return f};return b}(),bi._layerid=0,bp.SymbolGroup=bi,bp.Kartograph.prototype.addSymbols=function(a){a.map=this;return new bi(a)},g=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.radius=(d=b.radius)!=null?d:4,c.style=(e=b.style)!=null?e:"",c.title=b.title,c["class"]=(f=b["class"])!=null?f:"bubble"}bU(a,bh),a.prototype.overlaps=function(a){var b,c,d,e,f,g,h,i,j,k,l;d=this,k=[d.x,d.y,d.radius],g=k[0],i=k[1],e=k[2],l=[a.x,a.y,a.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+e<h-f||i-e>j+f||i+e<j-f)return!1;b=g-h,c=i-j;return b*b+c*c>(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.mapcanvas.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]),a.title!=null&&b.attr("title",a.title);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class","title"],g.layers=[],bp.Bubble=g,z=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bU(a,bp.Symbol),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$("<img />"),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),z.props=["icon","offset","class","title","iconsize"],z.layers=[],bp.Icon=z,bg=function(){function a(b){var c,d,e,f,g;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:"",c.offset=(g=b.offset)!=null?g:[0,0]}bU(a,bp.Symbol),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x+a.offset[0],y:a.y+a.offset[1]}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),bg.props=["text","style","class","offset"],bg.layers=[],bp.Label=bg,y=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bU(a,bp.Symbol),a.prototype.render=function(a){var b,c,d;d=this,b=$("<div>"+d.text+"</div>"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('<div class="label" />'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),y.props=["text","style","class"],y.layers=[{id:"lbl",type:"html"}],bp.HtmlLabel=y,S=function(){function b(c){var d,e,f,g,h,i,j,k,l,m;a=this,b.__super__.constructor.call(this,c),a.radius=(e=c.radius)!=null?e:4,a.styles=(f=c.styles)!=null?f:"",a.colors=(g=c.colors)!=null?g:["#3cc","#c3c","#33c","#cc3"],a.titles=(h=c.titles)!=null?h:["","","","",""],a.values=(i=c.values)!=null?i:[],a.border=(j=c.border)!=null?j:!1,a.borderWidth=(k=c.borderWidth)!=null?k:2,a["class"]=(l=c["class"])!=null?l:"piechart",(m=(d=Raphael.fn).pieChart)==null&&(d.pieChart=bn)}var a;bU(b,bh),a=null,b.prototype.overlaps=function(b){var c,d,e,f,g,h,i,j,k,l;k=[a.x,a.y,a.radius],g=k[0],i=k[1],e=k[2],l=[b.x,b.y,b.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+e<h-f||i-e>j+f||i+e<j-f)return!1;c=g-h,d=i-j;return c*c+d*d>(e+f)*(e+f)?!1:!0},b.prototype.render=function(b){var c;a=this,a.border!=null&&(c=a.layers.mapcanvas.circle(a.x,a.y,a.radius+a.borderWidth).attr({stroke:"none",fill:a.border})),a.chart=a.layers.mapcanvas.pieChart(a.x,a.y,a.radius,a.values,a.titles,a.colors,"none"),a.chart.push(c);return a},b.prototype.update=function(b){var c;return},b.prototype.clear=function(){var b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c<d;c++)b=e[c],b.remove();return a},b.prototype.nodes=function(){return[a.path.node]};return b}(),S.props=["radius","values","styles","class","titles","colors","border","borderWidth"],S.layers=[],bp.PieChart=S,bn=function(a,b,c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r;if(isNaN(a)||isNaN(b)||isNaN(c))return[];k=this,m=Math.PI/180,i=k.set(),n=function(a,b,c,d,e,f){var g,h,i,j;g=a+c*Math.cos(-d*m),h=a+c*Math.cos(-e*m),i=b+c*Math.sin(-d*m),j=b+c*Math.sin(-e*m);return k.path(["M",a,b,"L",g,i,"A",c,c,0,+(e-d>180),0,h,j,"z"]).attr(f)},h=-270,o=0,l=function(e){var j,k,l,m,p,q,r;r=d[e],j=360*r/o,q=h+j*.5,k=f[e],m=500,l=30,p=n(a,b,c,h,h+j,{fill:k,stroke:g,"stroke-width":1}),p.mouseover(function(){p.stop().animate({transform:"s1.1 1.1 "+a+" "+b},m,"elastic")}),p.mouseout(function(){p.stop().animate({transform:""},m,"elastic")}),h+=j,i.push(p)};for(q=0,r=d.length;q<r;q++)p=d[q],o+=p;for(j in d)l(j);return i},drawStackedBars=function(a,b,c,d,e,f,g,h){function k(a,b,c,d,e){return i.rect(a,b,c,d).attr(e)}var i=this,j=this.set(),l=0,m=0,n=function(f){var i=e[f],n=d*i/m,o=a-c*.5,p=b+d*.5-l,q=c,r=g[f],s=500,t=30,u=k(o,p-n,q,n,{fill:r,stroke:h,"stroke-width":1});l+=n,u.mouseover(function(){u.stop().animate({transform:"s1.1 1.1 "+a+" "+b},s,"elastic")}).mouseout(function(){u.stop().animate({transform:""},s,"elastic")}),j.push(u)};for(var o=0,p=e.length;o<p;o++)m+=e[o];for(o=0;o<p;o++)n(o);return j},be=function(){function a(b){var c,d,e,f,g,h,i,j,k,l;c=this,a.__super__.constructor.call(this,b),c.styles=(e=b.styles)!=null?e:"",c.colors=(f=b.colors)!=null?f:[],c.titles=(g=b.titles)!=null?g:["","","","",""],c.values=(h=b.values)!=null?h:[],c.width=(i=b.width)!=null?i:17,c.height=(j=b.height)!=null?j:30,c["class"]=(k=b["class"])!=null?k:"barchart",(l=(d=Raphael.fn).drawStackedBarChart)==null&&(d.drawStackedBarChart=drawStackedBars)}bU(a,bp.Symbol),a.prototype.overlaps=function(a){var b,c,d,e,f,g,h,i,j,k,l;d=this,k=[d.x,d.y,d.radius],g=k[0],i=k[1],e=k[2],l=[a.x,a.y,a.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+e<h-f||i-e>j+f||i+e<j-f)return!1;b=g-h,c=i-j;return b*b+c*c>(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b,c,d,e,f,g;d=this,e=d.width,c=d.height,f=d.x,g=d.y,b=d.layers.mapcanvas.rect(f-e*.5-2,g-c*.5-2,e+4,c+4).attr({stroke:"none",fill:"#fff"}),d.chart=d.layers.mapcanvas.drawStackedBarChart(d.x,d.y,d.width,d.height,d.values,d.titles,d.colors,"none"),d.chart.push(b);return d},a.prototype.update=function(){var a,b;a=this;return},a.prototype.clear=function(){var a,b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c<d;c++)b=e[c],b.remove();a.chart=[];return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),be.props=["values","styles","class","titles","colors","width","height"],be.layers=[],bp.StackedBarChart=be}).call(this)(function(){var a,b,c,d,e,f,g,h,i,j,k,l=Object.prototype.hasOwnProperty,m=function(a,b){function d(){this.constructor=a}for(var c in b)l.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a};h=typeof exports!="undefined"&&exports!==null?exports:this,g=(j=h.chroma)!=null?j:h.chroma={},typeof module!="undefined"&&module!==null&&(module.exports=g),g.version="0.2.5",c=function(){function a(b,c,d,e){var f,g;f=this,b==null&&c==null&&d==null&&e==null&&(b=[255,0,255]),i(b)==="array"&&b.length===3&&(e==null&&(e=c),g=b,b=g[0],c=g[1],d=g[2]),i(b)==="string"?e="hex":e==null&&(e="rgb"),e==="rgb"?f.rgb=[b,c,d]:e==="hsl"?f.rgb=a.hsl2rgb(b,c,d):e==="hsv"?f.rgb=a.hsv2rgb(b,c,d):e==="hex"?f.rgb=a.hex2rgb(b):e==="lab"?f.rgb=a.lab2rgb(b,c,d):e==="csl"?f.rgb=a.csl2rgb(b,c,d):e==="hsi"&&(f.rgb=a.hsi2rgb(b,c,d))}a.prototype.hex=function(){return a.rgb2hex(this.rgb)},a.prototype.toString=function(){return this.hex()},a.prototype.hsl=function(){return a.rgb2hsl(this.rgb)},a.prototype.hsv=function(){return a.rgb2hsv(this.rgb)},a.prototype.lab=function(){return a.rgb2lab(this.rgb)},a.prototype.csl=function(){return a.rgb2csl(this.rgb)},a.prototype.hsi=function(){return a.rgb2hsi(this.rgb)},a.prototype.interpolate=function(b,c,d){var e,f,g,h,j,k,l,m,n,o,p,q,r;m=this,d==null&&(d="rgb"),i(c)==="string"&&(c=new a(c));if(d==="hsl"||d==="hsv"||d==="csl"||d==="hsi"){d==="hsl"?(q=m.hsl(),r=c.hsl()):d==="hsv"?(q=m.hsv(),r=c.hsv()):d==="csl"?(q=m.csl(),r=c.csl()):d==="hsi"&&(q=m.hsi(),r=c.hsi()),g=q[0],o=q[1],k=q[2],h=r[0],p=r[1],l=r[2];if(!isNaN(g)&&!isNaN(h))h>g&&h-g>180?e=h-(g+360):h<g&&g-h>180?e=h+360-g:e=h-g,f=g+b*e;else if(!isNaN(g)){f=g;if(l===1||l===0)n=o}else if(!isNaN(h)){f=h;if(k===1||k===0)n=p}else f=void 0;n==null&&(n=o+b*(p-o)),j=k+b*(l-k);return new a(f,n,j,d)}if(d==="rgb"){q=m.rgb,r=c.rgb;return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}if(d==="lab"){q=m.lab(),r=c.lab();return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}throw"color mode "+d+" is not supported"};return a}(),c.hex2rgb=function(a){var b,c,d,e;if(!a.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))if(g.colors!=null&&g.colors[a])a=g.colors[a];else throw"unknown color format: "+a;if(a.length===4||a.length===7)a=a.substr(1);a.length===3&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),e=parseInt(a,16),d=e>>16,c=e>>8&255,b=e&255;return[d,c,b]},c.rgb2hex=function(a,b,c){var d,e,f;a!==void 0&&a.length===3&&(f=a,a=f[0],b=f[1],c=f[2]),e=a<<16|b<<8|c,d="000000"+e.toString(16).toUpperCase();return"#"+d.substr(d.length-6)},c.hsv2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t;i(a)==="array"&&a.length===3&&(n=a,a=n[0],b=n[1],h=n[2]),c*=255;if(b===0&&isNaN(a))l=f=d=c;else{a===360&&(a=0),a>360&&(a-=360),a<0&&(a+=360),a/=60,g=Math.floor(a),e=a-g,j=c*(1-b),k=c*(1-b*e),m=c*(1-b*(1-e));switch(g){case 0:o=[c,m,j],l=o[0],f=o[1],d=o[2];break;case 1:p=[k,c,j],l=p[0],f=p[1],d=p[2];break;case 2:q=[j,c,m],l=q[0],f=q[1],d=q[2];break;case 3:r=[j,k,c],l=r[0],f=r[1],d=r[2];break;case 4:s=[m,j,c],l=s[0],f=s[1],d=s[2];break;case 5:t=[c,j,k],l=t[0],f=t[1],d=t[2]}}l=Math.round(l),f=Math.round(f),d=Math.round(d);return[l,f,d]},c.rgb2hsv=function(a,b,c){var d,e,f,g,h,i,j;a!==void 0&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),g=Math.min(a,b,c),f=Math.max(a,b,c),d=f-g,i=f/255,h=d/f,h===0?(e=void 0,h=0):(a===f&&(e=(b-c)/d),b===f&&(e=2+(c-a)/d),c===f&&(e=4+(a-b)/d),e*=60,e<0&&(e+=360));return[e,h,i]},c.hsl2rgb=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;a!==void 0&&a.length===3&&(l=a,a=l[0],b=l[1],c=l[2]);if(b===0)h=f=d=c*255;else{k=[0,0,0],e=[0,0,0],j=c<.5?c*(1+b):c+b-c*b,i=2*c-j,a/=360,k[0]=a+1/3,k[1]=a,k[2]=a-1/3;for(g=0;g<=2;g++)k[g]<0&&(k[g]+=1),k[g]>1&&(k[g]-=1),6*k[g]<1?e[g]=i+(j-i)*6*k[g]:2*k[g]<1?e[g]=j:3*k[g]<2?e[g]=i+(j-i)*(2/3-k[g])*6:e[g]=i;m=[Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)],h=m[0],f=m[1],d=m[2]}return[h,f,d]},c.rgb2hsl=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=Math.max(a,b,c),e=(f+g)/2,f===g?(h=0,d=void 0):h=e<.5?(f-g)/(f+g):(f-g)/(2-f-g),a===f?d=(b-c)/(f-g):b===f?d=2+(c-a)/(f-g):c===f&&(d=4+(a-b)/(f-g)),d*=60,d<0&&(d+=360);return[d,h,e]},c.lab2xyz=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=function(a){return a>6/29?a*a*a:3*(6/29)*(6/29)*(a-4/29)},f=(a+.16)/1.16,e=[.96421,1,.82519],h=e[1]*d(f),g=e[0]*d(f+b/5),j=e[2]*d(f-c/2);return[g,h,j]},c.xyz2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n;i(a)==="array"&&a.length===3&&(m=a,a=m[0],b=m[1],c=m[2]),l=3.2406*a-1.5372*b-.4986*c,j=-0.9689*a+1.8758*b+.0415*c,e=.0557*a-.204*b+1.057*c,f=Math.min(l,j,e)<-0.001||Math.max(l,j,e)>1.001,f&&(l=l<0?0:l>1?1:l,j=j<0?0:j>1?1:j,e=e<0?0:e>1?1:e),f&&(n=[void 0,void 0,void 0],l=n[0],j=n[1],e=n[2]),g=function(a){var b;b=.055;return a<=.0031308?12.92*a:(1+b)*Math.pow(a,1/2.4)-b},k=Math.round(255*g(l)),h=Math.round(255*g(j)),d=Math.round(255*g(e));return[k,h,d]},c.lab2rgb=function(a,b,d){var e,f,g,h,i,j;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],d=i[2]),j=c.lab2xyz(a,b,d),e=j[0],f=j[1],g=j[2];return c.xyz2rgb(e,f,g)},c.csl2lab=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),a/=360,e=6.283185307179586,d=c*.61+.09,g=e/6-a*e,j=(c*.311+.125)*b,f=Math.sin(g)*j,h=Math.cos(g)*j;return[d,f,h]},c.csl2rgb=function(a,b,d){var e,f,g,h;h=c.csl2lab(a,b,d),e=h[0],f=h[1],g=h[2];return c.lab2rgb(e,f,g)},c.rgb2xyz=function(a,b,c){var d,e,f,g,h,i,j,k;a!==void 0&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=function(a){var b;b=.055;return a<=.04045?a/12.92:Math.pow((a+b)/(1+b),2.4)},g=e(a/255),f=e(b/255),d=e(c/255),h=.4124*g+.3576*f+.1805*d,i=.2126*g+.7152*f+.0722*d,j=.0193*g+.1192*f+.9505*d;return[h,i,j]},c.xyz2lab=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),g=[.96421,1,.82519],f=function(a){return a>Math.pow(6/29,3)?Math.pow(a,1/3):7.787037037037035*a+4/29},h=1.16*f(b/g[1])-.16,d=5*(f(a/g[0])-f(b/g[1])),e=2*(f(b/g[1])-f(c/g[2]));return[h,d,e]},c.rgb2lab=function(a,b,d){var e,f,g,h,i;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),i=c.rgb2xyz(a,b,d),e=i[0],f=i[1],g=i[2];return c.xyz2lab(e,f,g)},c.lab2csl=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=a,a=(a-.09)/.61,h=Math.sqrt(b*b+c*c),j=h/(a*.311+.125),e=6.283185307179586,f=Math.atan2(b,c),g=(e/6-f)/e,g*=360,g<0&&(g+=360);return[g,j,a]},c.rgb2csl=function(a,b,d){var e,f,g,h;i(a)==="array"&&a.length===3&&(g=a,a=g[0],b=g[1],d=g[2]),h=c.rgb2lab(a,b,d),f=h[0],e=h[1],d=h[2];return c.lab2csl(f,e,d)},c.rgb2hsi=function(a,b,c){var d,e,f,g,h,j;i(a)==="array"&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),d=Math.PI*2,a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=(a+b+c)/3,h=1-g/f,h===0?e=0:(e=(a-b+(a-c))/2,e/=Math.sqrt((a-b)*(a-b)+(a-c)*(b-c)),e=Math.acos(e),c>b&&(e=d-e),e/=d);return[e*360,h,f]},c.hsi2rgb=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=Math.PI*2,d=Math.PI/3,g=Math.cos,a<0&&(a+=360),a>360&&(a-=360),a/=360,a<1/3?(f=(1-b)/3,j=(1+b*g(e*a)/g(d-e*a))/3,h=1-(f+j)):a<2/3?(a-=1/3,j=(1-b)/3,h=(1+b*g(e*a)/g(d-e*a))/3,f=1-(j+h)):(a-=2/3,h=(1-b)/3,f=(1+b*g(e*a)/g(d-e*a))/3,j=1-(h+f)),j=c*j*3,h=c*h*3,f=c*f*3;return[j*255,h*255,f*255]},g.Color=c,g.hsl=function(a,b,d){return new c(a,b,d,"hsl")},g.hsv=function(a,b,d){return new c(a,b,d,"hsv")},g.rgb=function(a,b,d){return new c(a,b,d,"rgb")},g.hex=function(a){return new c(a)},g.lab=function(a,b,d){return new c(a,b,d,"lab")},g.csl=function(a,b,d){return new c(a,b,d,"csl")},g.hsi=function(a,b,d){return new c(a,b,d,"hsi")},g.interpolate=function(a,b,d,e){i(a)==="string"&&(a=new c(a)),i(b)==="string"&&(b=new c(b));return a.interpolate(d,b,e)},d=function(){function a(a){var b,d,e,f,g,h,j,k,l,m;f=this,f.colors=e=(g=a.colors)!=null?g:["#ddd","#222"];for(b=0,h=e.length-1;0<=h?b<=h:b>=h;0<=h?b++:b--)d=e[b],i(d)==="string"&&(e[b]=new c(d));if(a.positions!=null)f.pos=a.positions;else{f.pos=[];for(b=0,j=e.length-1;0<=j?b<=j:b>=j;0<=j?b++:b--)f.pos.push(b/(e.length-1))}f.mode=(k=a.mode)!=null?k:"hsv",f.nacol=(l=a.nacol)!=null?l:"#ccc",f.setClasses((m=a.limits)!=null?m:[0,1]),f}a.prototype.getColor=function(a){var b,c,d,e;e=this;if(isNaN(a))return e.nacol;e.classLimits.length>2?(b=e.getClass(a),c=b/(e.numClasses-1)):(c=d=(a-e.min)/(e.max-e.min),c=Math.min(1,Math.max(0,c)));return e.fColor(c)},a.prototype.fColor=function(a){var b,c,d,e,f,h;e=this,c=e.colors;for(d=0,h=e.pos.length-1;0<=h?d<=h:d>=h;0<=h?d++:d--){f=e.pos[d];if(a<=f){b=c[d];break}if(a>=f&&d===e.pos.length-1){b=c[d];break}if(a>f&&a<e.pos[d+1]){a=(a-f)/(e.pos[d+1]-f),b=g.interpolate(c[d],c[d+1],a,e.mode);break}}return b},a.prototype.classifyValue=function(a){var b,c,d,e,f,g;g=this,c=g.classLimits,c.length>2&&(f=c.length-1,b=g.getClass(a),a=c[b]+(c[b+1]-c[b])*.5,e=c[0],d=c[f-1],a=g.min+(a-e)/(d-e)*(g.max-g.min));return a},a.prototype.setClasses=function(a){var b;a==null&&(a=[]),b=this,b.classLimits=a,b.min=a[0],b.max=a[a.length-1];return a.length===2?b.numClasses=0:b.numClasses=a.length-1},a.prototype.getClass=function(a){var b,c,d,e;e=this,c=e.classLimits;if(c!=null){d=c.length-1,b=0;while(b<d&&a>=c[b])b++;return b-1}},a.prototype.validValue=function(a){return!isNaN(a)};return a}(),g.ColorScale=d,f=function(){function a(b,c,d){b==null&&(b="#fe0000"),c==null&&(c="#feeeee"),d==null&&(d="hsl"),a.__super__.constructor.call(this,[b,c],[0,1],d)}m(a,d);return a}(),g.Ramp=f,e=function(){function a(b,c,d,e,f){var g;b==null&&(b="#d73027"),c==null&&(c="#ffffbf"),d==null&&(d="#1E6189"),e==null&&(e="mean"),f==null&&(f="hsl"),g=this,g.mode=f,g.center=e,a.__super__.constructor.call(this,[b,c,d],[0,.5,1],f)}m(a,d),a.prototype.parseData=function(b,c){var d,e;a.__super__.parseData.call(this,b,c),e=this,d=e.center,d==="median"?d=e.median:d==="mean"&&(d=e.mean);return e.pos[1]=(d-e.min)/(e.max-e.min)};return a}(),g.Diverging=e,b=function(){function a(a){var b;b=this,b.colors=a}m(a,d),a.prototype.parseData=function(a,b){},a.prototype.getColor=function(a){var b;b=this;return b.colors.hasOwnProperty(a)?b.colors[a]:"#cccccc"},a.prototype.validValue=function(a){return this.colors.hasOwnProperty(a)};return a}(),g.Categories=b,a=function(){function a(a){var b;b=this,b.name=a,b.setClasses(7),b}m(a,d),a.prototype.getColor=function(a){var b,c;c=this,b=c.getClass(a);return c.name+" l"+c.numClasses+" c"+b};return a}(),g.CSSColors=a,(k=g.scales)==null&&(g.scales={}),g.scales.cool=function(){return new f(g.hsl(180,1,.9),g.hsl(250,.7,.4))},g.scales.hot=function(){return new d({colors:["#000000","#ff0000","#ffff00","#ffffff"],positions:[0,.25,.75,1],mode:"rgb"})},g.scales.BlWhOr=function(){return new e(g.hsl(30,1,.55),"#ffffff",new c(220,1,.55))},g.scales.GrWhPu=function(){return new e(g.hsl(120,.8,.4),"#ffffff",new c(280,.8,.4))},g.limits=function(a,b,c,d){var e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;b==null&&(b="equal"),c==null&&(c=7),d==null&&(d=null),r=Number.MAX_VALUE,q=Number.MAX_VALUE*-1,B=0,F=[];if(i(a)==="array")if(i(a[0])!=="object"&&i(a[0])!=="array")for(G=0,J=a.length;G<J;G++)D=a[G],isNaN(D)||F.push(D);else for(H=0,K=a.length;H<K;H++)A=a[H],F.push(A[d]);else if(i(a)==="object")for(n in a)D=a[n],i(D)==="object"&&i(d)==="string"?isNaN(D[d])||F.push(D[d]):i(D)==="array"&&i(d)==="number"?isNaN(D[d])||F.push(D[d]):i(D)==="number"&&(isNaN(D)||F.push(D));for(I=0,L=F.length;I<L;I++){D=F[I];if(!isNaN(D))D<r&&(r=D),D>q&&(q=D),B+=D;else continue}F=F.sort(),p=[],b.substr(0,1)==="c"&&(p.push(r),p.push(q));if(b.substr(0,1)==="e"){p.push(r);for(l=1,T=c-1;1<=T?l<=T:l>=T;1<=T?l++:l--)p.push(r+l/c*(q-r));p.push(q)}else if(b.substr(0,1)==="q"){p.push(r);for(l=1,U=c-1;1<=U?l<=U:l>=U;1<=U?l++:l--)w=F.length*l/c,x=Math.floor(w),x===w?p.push(F[x]):(y=w-x,p.push(F[x]*y+F[x+1]*(1-y)));p.push(q)}else if(b.substr(0,1)==="k"){t=F.length,e=Array(t),j=Array(c),z=!0,u=0,g=null,g=[],g.push(r);for(l=1,V=c-1;1<=V?l<=V:l>=V;1<=V?l++:l--)g.push(r+l/c*(q-r));g.push(q);while(z){for(m=0,W=c-1;0<=W?m<=W:m>=W;0<=W?m++:m--)j[m]=0;for(l=0,X=t-1;0<=X?l<=X:l>=X;0<=X?l++:l--){E=F[l],s=Number.MAX_VALUE;for(m=0,Y=c-1;0<=Y?m<=Y:m>=Y;0<=Y?m++:m--)k=Math.abs(g[m]-E),k<s&&(s=k,f=m);j[f]++,e[l]=f}v=Array(c);for(m=0,Z=c-1;0<=Z?m<=Z:m>=Z;0<=Z?m++:m--)v[m]=null;for(l=0,M=t-1;0<=M?l<=M:l>=M;0<=M?l++:l--)h=e[l],v[h]===null?v[h]=F[l]:v[h]+=F[l];for(m=0,N=c-1;0<=N?m<=N:m>=N;0<=N?m++:m--)v[m]*=1/j[m];z=!1;for(m=0,O=c-1;0<=O?m<=O:m>=O;0<=O?m++:m--)if(v[m]!==g[l]){z=!0;break}g=v,u++,u>200&&(z=!1)}o={};for(m=0,P=c-1;0<=P?m<=P:m>=P;0<=P?m++:m--)o[m]=[];for(l=0,Q=t-1;0<=Q?l<=Q:l>=Q;0<=Q?l++:l--)h=e[l],o[h].push(F[l]);C=[];for(m=0,R=c-1;0<=R?m<=R:m>=R;0<=R?m++:m--)C.push(o[m][0]),C.push(o[m][o[m].length-1]);C=C.sort(function(a,b){return a-b}),p.push(C[0]);for(l=1,S=C.length-1;l<=S;l+=2)isNaN(C[l])||p.push(C[l])}return p},i=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c<d;c++)b=e[c],a["[object "+b+"]"]=b.toLowerCase();return function(b){var c;c=Object.prototype.toString.call(b);return a[c]||"object"}}(),h=typeof exports!="undefined"&&exports!==null?exports:this,h.type=i,Array.max=function(a){return Math.max.apply(Math,a)},Array.min=function(a){return Math.min.apply(Math,a)}}).call(this)/**
ColorBrewer colors for chroma.js:
Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
and The Pennsylvania State University.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the License.
Named colors are taken from X11 Color Names.
http://www.w3.org/TR/css3-color/#svg-color
**/(function(){var a,b,c,d,e,f;d=typeof exports!="undefined"&&exports!==null?exports:this,b=(e=d.chroma)!=null?e:d.chroma={},b.brewer=a={},a.OrRd=["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],a.PuBu=["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],a.BuPu=["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],a.Oranges=["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],a.BuGn=["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],a.YlOrBr=["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],a.YlGn=["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],a.Reds=["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],a.RdPu=["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],a.Greens=["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],a.YlGnBu=["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],a.Purples=["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],a.GnBu=["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],a.Greys=["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],a.YlOrRd=["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],a.PuRd=["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],a.Blues=["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],a.PuBuGn=["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],a.Spectral=["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],a.RdYlGn=["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],a.RdBu=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],a.PiYG=["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],a.PRGn=["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],a.RdYlBu=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],a.BrBG=["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],a.RdGy=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],a.PuOr=["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],a.Set2=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],a.Accent=["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],a.Set1=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],a.Set3=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],a.Dark2=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],a.Paired=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],a.Pastel2=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],a.Pastel1=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"],d=typeof exports!="undefined"&&exports!==null?exports:this,b=(f=d.chroma)!=null?f:d.chroma={},b.colors=c={},c.indigo="#4b0082",c.gold="#ffd700",c.hotpink="#ff69b4",c.firebrick="#b22222",c.indianred="#cd5c5c",c.yellow="#ffff00",c.mistyrose="#ffe4e1",c.darkolivegreen="#556b2f",c.olive="#808000",c.darkseagreen="#8fbc8f",c.pink="#ffc0cb",c.tomato="#ff6347",c.lightcoral="#f08080",c.orangered="#ff4500",c.navajowhite="#ffdead",c.lime="#00ff00",c.palegreen="#98fb98",c.darkslategrey="#2f4f4f",c.greenyellow="#adff2f",c.burlywood="#deb887",c.seashell="#fff5ee",c.mediumspringgreen="#00fa9a",c.fuchsia="#ff00ff",c.papayawhip="#ffefd5",c.blanchedalmond="#ffebcd",c.chartreuse="#7fff00",c.dimgray="#696969",c.black="#000000",c.peachpuff="#ffdab9",c.springgreen="#00ff7f",c.aquamarine="#7fffd4",c.white="#ffffff",c.orange="#ffa500",c.lightsalmon="#ffa07a",c.darkslategray="#2f4f4f",c.brown="#a52a2a",c.ivory="#fffff0",c.dodgerblue="#1e90ff",c.peru="#cd853f",c.lawngreen="#7cfc00",c.chocolate="#d2691e",c.crimson="#dc143c",c.forestgreen="#228b22",c.darkgrey="#a9a9a9",c.lightseagreen="#20b2aa",c.cyan="#00ffff",c.mintcream="#f5fffa",c.silver="#c0c0c0",c.antiquewhite="#faebd7",c.mediumorchid="#ba55d3",c.skyblue="#87ceeb",c.gray="#808080",c.darkturquoise="#00ced1",c.goldenrod="#daa520",c.darkgreen="#006400",c.floralwhite="#fffaf0",c.darkviolet="#9400d3",c.darkgray="#a9a9a9",c.moccasin="#ffe4b5",c.saddlebrown="#8b4513",c.grey="#808080",c.darkslateblue="#483d8b",c.lightskyblue="#87cefa",c.lightpink="#ffb6c1",c.mediumvioletred="#c71585",c.slategrey="#708090",c.red="#ff0000",c.deeppink="#ff1493",c.limegreen="#32cd32",c.darkmagenta="#8b008b",c.palegoldenrod="#eee8aa",c.plum="#dda0dd",c.turquoise="#40e0d0",c.lightgrey="#d3d3d3",c.lightgoldenrodyellow="#fafad2",c.darkgoldenrod="#b8860b",c.lavender="#e6e6fa",c.maroon="#800000",c.yellowgreen="#9acd32",c.sandybrown="#f4a460",c.thistle="#d8bfd8",c.violet="#ee82ee",c.navy="#000080",c.magenta="#ff00ff",c.dimgrey="#696969",c.tan="#d2b48c",c.rosybrown="#bc8f8f",c.olivedrab="#6b8e23",c.blue="#0000ff",c.lightblue="#add8e6",c.ghostwhite="#f8f8ff",c.honeydew="#f0fff0",c.cornflowerblue="#6495ed",c.slateblue="#6a5acd",c.linen="#faf0e6",c.darkblue="#00008b",c.powderblue="#b0e0e6",c.seagreen="#2e8b57",c.darkkhaki="#bdb76b",c.snow="#fffafa",c.sienna="#a0522d",c.mediumblue="#0000cd",c.royalblue="#4169e1",c.lightcyan="#e0ffff",c.green="#008000",c.mediumpurple="#9370db",c.midnightblue="#191970",c.cornsilk="#fff8dc",c.paleturquoise="#afeeee",c.bisque="#ffe4c4",c.slategray="#708090",c.darkcyan="#008b8b",c.khaki="#f0e68c",c.wheat="#f5deb3",c.teal="#008080",c.darkorchid="#9932cc",c.deepskyblue="#00bfff",c.salmon="#fa8072",c.darkred="#8b0000",c.steelblue="#4682b4",c.palevioletred="#db7093",c.lightslategray="#778899",c.aliceblue="#f0f8ff",c.lightslategrey="#778899",c.lightgreen="#90ee90",c.orchid="#da70d6",c.gainsboro="#dcdcdc",c.mediumseagreen="#3cb371",c.lightgray="#d3d3d3",c.mediumturquoise="#48d1cc",c.lemonchiffon="#fffacd",c.cadetblue="#5f9ea0",c.lightyellow="#ffffe0",c.lavenderblush="#fff0f5",c.coral="#ff7f50",c.purple="#800080",c.aqua="#00ffff",c.whitesmoke="#f5f5f5",c.mediumslateblue="#7b68ee",c.darkorange="#ff8c00",c.mediumaquamarine="#66cdaa",c.darksalmon="#e9967a",c.beige="#f5f5dc",c.blueviolet="#8a2be2",c.azure="#f0ffff",c.lightsteelblue="#b0c4de",c.oldlace="#fdf5e6"}).call(this)