torque/dist/torque.full.js

18 lines
568 KiB
JavaScript
Raw Normal View History

2017-11-14 19:12:47 +08:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.torque=e()}}(function(){var define,module,exports;return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var s=typeof require=="function"&&require;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){var r=function(e,t){if(e<0)throw new Error("start must be a positive number");if(e>=t)throw new Error("start must be smaller than end");this.start=e,this.end=t};r.prototype={diff:function(){return this.end-this.start},isLast:function(e){return(e|0)===this.end}},t.exports=r},{}],2:[function(e,t,n){(function(n){function u(e,t){if(!t.steps)throw new Error("steps option missing");this.options=t,this.running=!1,this._tick=this._tick.bind(this),this._t0=+(new Date),this.callback=e,this._time=0,this.itemsReady=!1,this.options=r.extend({animationDelay:0,maxDelta:.2,loop:t.loop===undefined?!0:t.loop},this.options),this.steps(t.steps)}var r=e("./"),i=e("./animator-steps-range"),s=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){return n.setTimeout(e,1e3/60)},o=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.msCancelAnimationFrame||function(e){clearTimeout(e)};u.prototype={start:function(){this.running=!0,s(this._tick),this.options.onStart&&this.options.onStart(),this.stepsRange().diff()===1&&(this.running=!1)},isRunning:function(){return this.running},stop:function(){this.pause(),this.time(this.stepsRange().start),this.options.onStop&&this.options.onStop()},time:function(e){if(!arguments.length)return this._time;this._time=e;var t=this.range(this.domain(this._time));this.callback(t)},toggle:function(){this.running?this.pause():this.start()},rescale:function(){return this.domainInv=r.math.linear(this.options.animationDelay,this.options.animationDelay+this.options.animationDuration),this.domain=this.domainInv.invert(),this.range=r.math.linear(0,this._defaultStepsRange.end),this.rangeInv=this.range.invert(),this.time(this._time),this.running?this.start():this.pause(),this},duration:function(e){return arguments.length?(this.options.animationDuration=e,this.time()>e&&this.time(0),this.rescale(),this):this.options.animationDuration},steps:function(e){return this.options.steps=e,this._defaultStepsRange=new i(0,e),this.rescale()},stepsRange:function(e,t){if(arguments.length===2){if(e<this._defaultStepsRange.start)throw new Error("start must be within default steps range");if(t>this._defaultStepsRange.end)throw new Error("end must be within default steps range");this._customStepsRange=new i(e,t),this.options.onStepsRange&&this.options.onStepsRange();var n=this.step()|0;(n<e||n>t)&&this.step(e)}return this._customStepsRange||this._defaultStepsRange},removeCustomStepsRange:function(){this._customStepsRange=undefined,this.options.onStepsRange&&this.options.onStepsRange()},step:function(e){if(arguments.length===0)return this.range(this.domain(this._time));this._time=this.domainInv(this.rangeInv(e))},pause:function(){this.running=!1,o(this._tick),this.options.onPause&&this.options.onPause()},_tick:function(){var e=+(new Date),t=(e-this._t0)*.001;t=Math.min(this.options.maxDelta,t),this._t0=e,this._time+=t;var n=this.stepsRange();n.isLast(this.step())&&(this.options.loop?this.step(n.start):(this.time(this.options.animationDuration),this.pause())),this.running&&(this.time(this._time),s(this._tick))}},t.exports=u}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./":11,"./animator-steps-range":1}],3:[fun
2017-11-15 23:25:56 +08:00
,t,n){var r=this,i=1<<n,s={x:(t.x%i+i)%i,y:t.y};this.provider.getTileData(s,n,function(t){r._tileLoaded(e,t)})},drawTile:function(e){var t=e.canvas;if(!e.data)return;t.width=t.width,this.renderer.setCanvas(t);var n=this.renderer.accumulate(e.data,this.getKey());this.renderer.renderTileAccum(n,0,0)},setKey:function(e){this.keys=[e],this.redraw()},setCartoCSS:function(e){if(!this.renderer)throw new Error("renderer is not valid");return this.renderer.setCartoCSS(e)},setStepsRange:function(e,t){this.animator.stepsRange(e,t)},removeStepsRange:function(){this.animator.removeCustomStepsRange()},getStepsRange:function(){return this.animator.stepsRange()}}),t.exports={GMapsTiledTorqueLayer:f,GMapsTorqueLayer:a}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../":11,"./CanvasLayer":6,"./canvas_tile_layer":7,"./gmaps_tileloader_mixin":8,carto:40}],11:[function(e,t,n){t.exports=e("./core"),t.exports.Animator=e("./animator"),t.exports.cartocss_reference=e("./cartocss_reference"),t.exports.common=e("./common"),t.exports.math=e("./math"),t.exports.Mercator=e("./mercator"),t.exports.net=e("./request"),t.exports.renderer=e("./renderer"),t.exports.providers=e("./provider"),e("./leaflet");var r=e("./gmaps");t.exports.GMapsTileLoader=r.GMapsTileLoader,t.exports.GMapsTorqueLayer=r.GMapsTorqueLayer,t.exports.GMapsTiledTorqueLayer=r.GMapsTiledTorqueLayer,e("./ol")},{"./animator":2,"./cartocss_reference":3,"./common":4,"./core":5,"./gmaps":9,"./leaflet":13,"./math":16,"./mercator":17,"./ol":19,"./provider":23,"./renderer":30,"./request":34}],12:[function(e,t,n){e("./leaflet_tileloader_mixin"),L.CanvasLayer=L.Layer.extend({includes:[L.Mixin.Events,L.Mixin.TileLoader],options:{minZoom:0,maxZoom:28,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,tileLoader:!1,zoomAnimation:!0},initialize:function(e){var t=this;e=e||{},this.render=this.render.bind(this),L.Util.setOptions(this,e),this._canvas=this._createCanvas(),this.options.zoomAnimation&&(this._backCanvas=this._createCanvas()),this._ctx=this._canvas.getContext("2d"),this.currentAnimationFrame=-1,this.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)},this.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(e){clearTimeout(e)}},_createCanvas:function(){var e;e=document.createElement("canvas"),e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.pointerEvents="none",e.style.zIndex=this.options.zIndex||0;var t="leaflet-tile-container";return this.options.zoomAnimation&&(t+=" leaflet-zoom-animated"),e.setAttribute("class",t),e},onAdd:function(e){this._map=e;var t=this._map._panes.tilePane,n=L.DomUtil.create("div","leaflet-layer");n.appendChild(this._canvas),this.options.zoomAnimation&&(n.appendChild(this._backCanvas),this._backCanvas.style.display="none"),t.appendChild(n),this._container=n,e.dragging._draggable.on("predrag",function(){var t=e.dragging._draggable;L.DomUtil.setPosition(this._canvas,{x:-t._newPos.x,y:-t._newPos.y})},this),e.on({viewreset:this._reset},this),e.on("move",this.redraw,this),e.on("resize",this._reset,this),this.options.zoomAnimation&&e.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim,moveend:this._reset},this),this.options.tileLoader&&this._initTileLoader(),this._reset()},_animateZoom:function(e){this._animating||(this._animating=!0);var t=this._backCanvas;t.width=this._canvas.width,t.height=this._canvas.height;var n=this._canvas._leaflet_pos||{x:0,y:0};t.getContext("2d").drawImage(this._canvas,0,0),L.DomUtil.setPosition(t,L.DomUtil.getPosition(this._canvas)),this._canvas.style.display="none",t.style.display="block";var r=this._map,i=r.getZoomScale(e.zoom),s=r._latLngToNewLayerPoint(r.getCenter(),e.zoom,e.center),o=r._latLngToNewLay
2017-11-16 18:14:54 +08:00
){for(var t=1;t<arguments.length;++t){var n=arguments[t];for(var r in n)e=e.replace(RegExp("\\{"+r+"\\}","g"),n[r])}return e}var r=e("../"),i=e("../profiler"),s=r.types.Uint8Array,o=r.types.Int32Array,u=r.types.Uint32Array,f=function(e){this._ready=!1,this._tileQueue=[],this.options=e,this.options.is_time=this.options.is_time===undefined?!0:this.options.is_time,this.options.tiler_protocol=e.tiler_protocol||"http",this.options.tiler_domain=e.tiler_domain||"cartodb.com",this.options.tiler_port=e.tiler_port||80,this.options.data_aggregation&&(this.options.cumulative=this.options.data_aggregation==="cumulative");if(e.resolution===undefined)throw new Error("resolution should be provided");if(e.steps===undefined)throw new Error("steps should be provided");e.start===undefined?this._fetchKeySpan():this._setReady(!0)};f.prototype={proccessTile:function(e,t,n){var r,a=new s(e.length),f=new s(e.length),l=i.metric("ProviderJSON:mem"),c=i.metric("ProviderJSON:point_count"),h=i.metric("ProviderJSON:process_time").start(),p=0,d=-1;for(r=0;r<e.length;++r){var v=e[r];p+=v.dates__uint16.length;for(var m=0;m<v.dates__uint16.length;++m)d=Math.max(d,v.dates__uint16[m])}this.options.cumulative&&(p=(1+d)*e.length);var g=this.options.cumulative?u:s,y=new o(d+1),b=new o(d+1),w=new(this.options.valueDataType||g)(p),E=new u(p);l.inc(4*d+4*d+p+p*4),c.inc(e.length);var S={};for(var r=0;r<e.length;++r){var v=e[r];a[r]=v.x__uint8*this.options.resolution,v.y__uint8===-1?f[r]=0:f[r]=v.y__uint8*this.options.resolution;var p=v.dates__uint16,x=v.vals__uint8;if(!this.options.cumulative)for(var T=0,N=p.length;T<N;++T){var C=S[p[T]]||(S[p[T]]=[]);this.options.cumulative&&(x[T]+=prev_val),prev_val=x[T],C.push([r,x[T]])}else{var k={};for(var T=0,N=p.length;T<N;++T)k[p[T]]=x[T];var L=0;for(var T=p[0];T<=d;++T){var C=S[T]||(S[T]=[]),A=k[T];A&&(L+=A),C.push([r,L])}}}var O=0,M=0,_=0;for(var _=0;_<=d;++_){var D=0,P=S[_];if(P)for(var r=0;r<P.length;++r){var C=P[r];++D,E[O]=C[0],w[O]=C[1],++O}y[_]=M,b[_]=D,M+=D}return h.end(),{x:a,y:f,z:n,coord:{x:t.x,y:t.y,z:n},timeCount:b,timeIndex:y,renderDataPos:E,renderData:w,maxDate:d}},_host:function(){var e=this.options,t=e.sql_api_port,n=(e.user_name||e.user)+"."+(e.sql_api_domain||"cartodb.com")+(t?":"+t:""),r=e.sql_api_protocol||"http";return this.options.url||r+"://"+n+"/api/v2/sql"},url:function(e){var t=this.options,n=t.sql_api_protocol||"http";if(!this.options.cdn_url)return this._host();var r=n+"://";e&&(r+=e+".");var i=t.cdn_url;if(!i.http&&!i.https)throw new Error("cdn_host should contain http and/or https entries");return r+=i[n]+"/"+(t.user_name||t.user)+"/api/v2/sql",r},_hash:function(e){var t=0;if(!e||e.length==0)return t;for(var n=0,r=e.length;n<r;++n)t=(t<<5)-t+e.charCodeAt(n)|0;return t},_extraParams:function(){if(this.options.extra_params){var e=[];for(var t in this.options.extra_params){var n=this.options.extra_params[t];n&&e.push(t+"="+encodeURIComponent(n))}return e.join("&")}return null},isHttps:function(){return this.options.sql_api_protocol&&this.options.sql_api_protocol==="https"},sql:function(e,t,n){n=n||{};var i=this.options.subdomains||"0123";this.isHttps()&&(i=[null]);var s;n.no_cdn?s=this._host():s=this.url(i[Math.abs(this._hash(e))%i.length]);var o=this._extraParams();r.net.get(s+"?q="+encodeURIComponent(e)+(o?"&"+o:""),function(e){n.parseJSON&&(e=JSON.parse(e&&e.responseText)),t&&t(e)})},getTileData:function(e,t,n){this._ready?this._getTileData(e,t,n):this._tileQueue.push([e,t,n])},_setReady:function(e){this._ready=!0,this._processQueue(),this.options.ready&&this.options.ready()},_processQueue:function(){var e;while(e=this._tileQueue.pop())this._getTileData.apply(this,e)},_getTileData:function(e,t,n){var r=i.metric("ProviderJSON:tile_fetch_time").start();this.table=this.options.table;var s=1<<t,o=this.options.column;this.options.is_time&&(o=a("date_part('epoch', {column})",this.options));var u="WITH par AS ( SELECT CDB_XYZ_Resolution({zoom})*{resolution} as res, 256/{resolution} as tile_size, CDB_XYZ_Extent({x}, {y}, {zoom}) as ext ),cte AS ( SELECT ST_SnapToGrid(i.the_geom_webmercator, p.r
t._iconsToLoad--,t._iconsToLoad<=0&&(t.clearSpriteCache(),t.fire("allIconsLoaded")))})})}else this.fire("allIconsLoaded")},applyFilters:function(){if(this._style&&this._style["image-filters"]){function e(e){var t="";for(var n=0;n<e.args.length;n++){var r=e.args[n].rgb;t+=r[0]+":"+r[1]+":"+r[2]}return t}var t=this._gradients[e(this._style["image-filters"])];if(!t){function n(e){var t=e.toString(16);return t.length==1?"0"+t:t}function r(e,t,r){return"#"+n(e)+n(t)+n(r)}t={};var i=this._style["image-filters"].args,s=1/i.length;for(var o=0;o<i.length;o++){var u=s*o+s,a=i[o].rgb,f=r(a[0],a[1],a[2]);t[u]=f}this._gradients[e(this._style["image-filters"])]=t}this._filters.gradient(t),this._filters.draw()}}}),d.isTurboCarto=function(e){var t=["ramp","colorbrewer","buckets"],n=t.map(function(e){return e+"("}).map(String.prototype.indexOf.bind(e)).every(function(e){return e===-1});return!n},t.exports=d}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../":11,"../profiler":22,"./cartocss_render":28,"./datasource":29,"./torque_filters":33,carto:40,"turbo-carto":153}],32:[function(e,t,n){(function(n){function o(e,t){this.options=t,r.tree.Reference.set(torque["torque-reference"]),this.setCanvas(e),this.setCartoCSS(this.options.cartocss||i)}var r=n.carto||e("carto"),i=["#layer {"," polygon-fill: #FFFF00;"," [value > 10] { polygon-fill: #FFFF00; }"," [value > 100] { polygon-fill: #FFCC00; }"," [value > 1000] { polygon-fill: #FE9929; }"," [value > 10000] { polygon-fill: #FF6600; }"," [value > 100000] { polygon-fill: #FF3300; }","}"].join("\n"),s=Math.PI*2;o.prototype={setCartoCSS:function(e){this._cartoCssStyle=(new r.RendererJS).render(e);if(this._cartoCssStyle.getLayers().length>1)throw new Error("only one CartoCSS layer is supported");this._shader=this._cartoCssStyle.getLayers()[0].shader},setCanvas:function(e){if(!e)return;this._canvas=e,this._ctx=e.getContext("2d")},accumulate:function(e,t){var n=Profiler.metric("RectangleRender:accumulate").start(),r,i,s,o,u,a,f,l,c=this.options.resolution,h=256/c,p=new Float32Array(h*h);typeof t!="object"&&(t=[t]);for(u=0;u<t.length;++u){a=t[u],f=e.timeCount[a];if(f){l=e.timeIndex[a];for(o=0;o<f;++o)s=e.renderDataPos[l+o],r=e.x[s]/c,i=e.y[s]/c,p[r*h+i]+=e.renderData[l+o]}}return n.end(),p},renderTileAccum:function(e,t,n){var r=Profiler.metric("RectangleRender:renderTileAccum").start(),i,s,o,u,a=this.options.resolution,f=this._ctx,l=256/a|0,c=l*l,h=this._colors;this.options.blendmode&&(f.globalCompositeOperation=this.options.blendmode);var p=this._shader["polygon-opacity"]||function(){return 1};for(var d=0;d<c;++d){var v=d,m=e[d];m&&(s=v/l|0,o=v%l,i=this._shader["polygon-fill"]({value:m},{zoom:0}),f.fillStyle=i,u=p({value:m},{zoom:0}),u===null&&(u=1),f.globalAlpha=u,f.fillRect(s*a,256-a-o*a,a,a))}r.end()},renderTile:function(e,t,n){if(!this._canvas)return;var r=this.options.resolution,i=this._ctx,s=this._colors,o=e.timeCount[t];if(o){var u=this._canvas.width,a=this._canvas.height,f=e.timeIndex[t];for(var l=0;l<activePixels;++l){var c=e.renderDataPos[f+l],h=e.renderData[f+l];if(h){var p=s[Math.min(h,s.length-1)],d=e.x[c],v=e.y[c];i.fillStyle=p,i.fillRect(d,v,r,r)}}}return n&&n(null)}},t.exports=o}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{carto:40}],33:[function(e,t,n){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);t=t||{},this._canvas=e=typeof e=="string"?document.getElementById(e):e,this._ctx=e.getContext("2d"),this._width=e.width,this._height=e.height,this._max=1,this._data=[],this.canvasClass=t.canvasClass}r.prototype={defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},gradient:function(e){var t=this._createCanvas(),n=t.getContext("2d"),r=n.createLinearGradient(0,0,0,256);t.width=1,t.height=256;for(var i in e)r.addColorStop(+i,e[i]);return n.fillStyle=r,n.fillRect(0,0,1,256),this._grad=n.getImageData(0,0,1,256).data,this},draw:function(){this._grad||this.gradient(this.defaultGradient);var e=this._ctx,t=e.getImag
n[0]:n[1]!=r[1]?r[1]-n[1]:n[2]!=r[2]?r[2]-n[2]:r[3]-n[3]};return s},parsers:{primary:function(){var e,t=[];while((e=y(this.rule)||y(this.ruleset)||y(this.comment))||y(/^[\s\n]+/)||(e=y(this.invalid)))e&&t.push(e);return t},invalid:function(){var e=y(/^[^;\n]*[;\n]/);if(e)return new i.Invalid(e,a)},comment:function(){var e;if(n.charAt(r)!=="/")return;if(n.charAt(r+1)==="/")return new i.Comment(y(/^\/\/.*/),!0);if(e=y(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){if(n.charAt(r)!=='"'&&n.charAt(r)!=="'")return;var e=y(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);if(e)return new i.Quoted(e[1]||e[2])},field:function(){if(!y("["))return;var e=y(/(^[^\]]+)/);if(!y("]"))return;if(e)return new i.Field(e[1])},comparison:function(){var e=y(/^=~|=|!=|<=|>=|<|>/);if(e)return e},keyword:function(){var e=y(/^[A-Za-z-]+[A-Za-z-0-9_]*/);if(e)return new i.Keyword(e)},call:function(){var e,t;if(!(e=/^([\w\-]+|%)\(/.exec(l[o])))return;e=e[1];if(e==="url")return null;r+=e.length,y("("),t=y(this.entities.arguments);if(!y(")"))return;if(e)return new i.Call(e,t,r)},arguments:function(){var e=[],t;while(t=y(this.expression)){e.push(t);if(!y(","))break}return e},literal:function(){return y(this.entities.dimension)||y(this.entities.keywordcolor)||y(this.entities.hexcolor)||y(this.entities.quoted)},url:function(){var e;if(n.charAt(r)!=="u"||!y(/^url\(/))return;return e=y(this.entities.quoted)||y(this.entities.variable)||y(/^[\-\w%@$\/.&=:;#+?~]+/)||"",y(")")?new i.URL(typeof e.value!="undefined"||e instanceof i.Variable?e:new i.Quoted(e)):new i.Invalid(e,a,"Missing closing ) in URL.")},variable:function(){var e,s=r;if(n.charAt(r)==="@"&&(e=y(/^@[\w-]+/)))return new i.Variable(e,s,t.filename)},hexcolor:function(){var e;if(n.charAt(r)==="#"&&(e=y(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new i.Color(e[1])},keywordcolor:function(){var e=l[o].match(/^[a-z]+/);if(e&&e[0]in i.Reference.data.colors)return new i.Color(i.Reference.data.colors[y(/^[a-z]+/)])},dimension:function(){var e=n.charCodeAt(r);if(e>57||e<45||e===47)return;var t=y(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);if(t)return new i.Dimension(t[1],t[2],a)}},variable:function(){var e;if(n.charAt(r)==="@"&&(e=y(/^(@[\w-]+)\s*:/)))return e[1]},entity:function(){return y(this.entities.call)||y(this.entities.literal)||y(this.entities.field)||y(this.entities.variable)||y(this.entities.url)||y(this.entities.keyword)},end:function(){return y(";")||b("}")},element:function(){var e=y(/^(?:[.#][\w\-]+|\*|Map)/);if(e)return new i.Element(e)},attachment:function(){var e=y(/^::([\w\-]+(?:\/[\w\-]+)*)/);if(e)return e[1]},selector:function(){var e,t,s,o=[],u,f=new i.Filterset,l,c=[],h=i.FrameOffset.none;segments=0,conditions=0;while((s=y(this.element))||(l=y(this.zoom))||(fo=y(this.frame_offset))||(u=y(this.filter))||(e=y(this.attachment))){segments++;if(s)o.push(s);else if(l)c.push(l),conditions++;else if(fo)h=fo,conditions++;else if(u){var p=f.add(u);if(p)throw E({message:p,index:r-1});conditions++}else{if(t)throw E({message:"Encountered second attachment name.",index:r-1});t=e}var d=n.charAt(r);if(d==="{"||d==="}"||d===";"||d===",")break}if(segments)return new i.Selector(f,c,h,o,t,conditions,a)},filter:function(){v();var e,n,r;if(!y("["))return;if(e=y(/^[a-zA-Z0-9\-_]+/)||y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.keyword)||y(this.entities.field)){e instanceof i.Quoted&&(e=new i.Field(e.toString()));if((n=y(this.entities.comparison))&&(r=y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.dimension)||y(this.entities.keyword)||y(this.entities.field))){if(!y("]"))throw E({message:"Missing closing ] of filter.",index:a-1});return e.is||(e=new i.Field(e)),new i.Filter(e,n,r,a,t.filename)}}},frame_offset:function(){v();var e,t;if(y(/^\[\s*frame-offset/g)&&(e=y(this.entities.comparison))&&(t=y(/^\d+/))&&y("]"))return i.FrameOffset(e,t,a)},zoom:function(){v();var e,t;if(y(/^\[\s*zoom/g)&&(e=y(this.entities.comparison))&&(t=y(this.entities.variable)||y(this.entities.dimension))&&y("]"))return new i.Zoom(e,t,a);m()},bloc
:1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},placement:{css:"marker-placement",type:["point","line","interior"],"default-value":"point","default-meaning":"Place markers at the center point (centroid) of the geometry",doc:"Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"},"multi-policy":{css:"marker-multi-policy",type:["each","whole","largest"],"default-value":"each","default-meaning":"If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",doc:"A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."},"marker-type":{css:"marker-type",type:["arrow","ellipse","rectangle"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"float",expression:!0},height:{css:"marker-height","default-value":10,doc:"The height of the marker, if using one of the default types.",type:"float",expression:!0},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color",expression:!0},"allow-overlap":{css:"marker-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping markers are shown or hidden.","default-meaning":"Do not allow makers to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"marker-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},spacing:{css:"marker-spacing",doc:"Space between repeated labels","default-value":100,type:"float"},"max-error":{css:"marker-max-error",type:"float","default-value":.2,doc:"The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."},transform:{css:"marker-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},clip:{css:"marker-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"marker-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths
2017-11-15 23:25:56 +08:00
.isArray(t)?this.rgb=t.slice(0,3):t.length==6?this.rgb=t.match(/.{2}/g).map(function(e){return parseInt(e,16)}):this.rgb=t.split("").map(function(e){return parseInt(e+e,16)}),typeof n=="number"?this.alpha=n:t.length===4?this.alpha=t[3]:this.alpha=1},e.Color.prototype={is:"color",ev:function(){return this},toString:function(){return this.alpha<1?"rgba("+this.rgb.map(function(e){return Math.round(e)}).concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},operate:function(t,n,r){var i=[];r instanceof e.Color||(r=r.toColor());for(var s=0;s<3;s++)i[s]=e.operate(n,this.rgb[s],r.rgb[s]);return new e.Color(i)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t<n?6:0);break;case t:o=(n-e)/f+2;break;case n:o=(e-t)/f+4}o/=6}return{h:o*360,s:u,l:a,a:r}}}})(e("../tree"))},{"../tree":45}],48:[function(e,t,n){(function(e){e.Comment=function(t,n){this.value=t,this.silent=!!n},e.Comment.prototype={toString:function(e){return"<!--"+this.value+"-->"},ev:function(){return this}}})(e("../tree"))},{"../tree":45}],49:[function(e,t,n){(function(t){(function(n){function s(e){function t(e){return e[1].toUpperCase()}return e.charAt(0).toUpperCase()+e.slice(1).replace(/\-./,t)+"Symbolizer"}function o(e){return e.sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})}var r=e("assert"),i=t._||e("underscore");n.Definition=function(t,i){this.elements=t.elements,r.ok(t.filters instanceof n.Filterset),this.rules=i,this.ruleIndex={};for(var s=0;s<this.rules.length;s++)"zoom"in this.rules[s]&&(this.rules[s]=this.rules[s].clone()),this.rules[s].zoom=t.zoom,this.ruleIndex[this.rules[s].updateID()]=!0;this.filters=t.filters,this.zoom=t.zoom,this.frame_offset=t.frame_offset,this.attachment=t.attachment||"__default__",this.specificity=t.specificity()},n.Definition.prototype.toString=function(){var e=this.filters.toString();for(var t=0;t<this.rules.length;t++)e+="\n "+this.rules[t];return e},n.Definition.prototype.clone=function(e){e&&r.ok(e instanceof n.Filterset);var t=Object.create(n.Definition.prototype);return t.rules=this.rules.slice(),t.ruleIndex=i.clone(this.ruleIndex),t.filters=e?e:this.filters.clone(),t.attachment=this.attachment,t},n.Definition.prototype.addRules=function(e){var t=0;for(var n=0;n<e.length;n++)this.ruleIndex[e[n].id]||(this.rules.push(e[n]),this.ruleIndex[e[n].id]=!0,t++);return t},n.Definition.prototype.appliesTo=function(e,t){for(var n=0,r=this.elements.length;n<r;n++){var i=this.elements[n];if(!(i.wildcard||i.type==="class"&&t[i.clean]||i.type==="id"&&e===i.clean))return!1}return!0},n.Definition.prototype.symbolizersToXML=function(e,t,r){var i=r.toXML(e).join("")+this.filters.toXML(e),u=[],a=[];for(var f in t){a=[];for(var l in t[f])a.push(t[f][l].index);var c=Math.min.apply(Math,a);u.push([f,c])}u=o(u);var h=0;for(var p=0;p<u.length;p++){var d=t[u[p]],v=u[p].split("/").pop();if(v==="*")continue;h++;var m=n.Reference.requiredProperties(v,d);if(m){var g=d[Object.keys(d).shift()];e.error({message:m,index:g.index,filename:g.filename})}var y=s(v),b=!0,w;i+=" <"+y+" ";for(var E in d){v==="map"&&e.error({message:"Map properties are not permitted in other rules",index:d[E].index,filename:d[E].filename});var S=n.Reference.selector(d[E].name);S&&S.serialization&&S.serialization==="content"?(b=!1,w=d[E].ev(e).toXML(e,!0)):S&&S.serialization&&S.serialization==="tag"?(b=!1,w=d[E].ev(e).toXML(e,!0)):i+=d[E].ev(e).toXML(e)+" "}b?i+="/>\n":typeof w!="undefined"&&(w.indexOf("<")!=-1?i+=">"+w+"</"+y+">\n":i+="><![CDATA["+w+"]]></"+y+">\n")}return!h||!i?"":" <Rule>\n"+i+" </Rule>\n"},n.Definition.prototype.collectSymbolizers=function(e,t){var n={},r;for(var i=t;i<this.rules.length;i++){r=this.rules[i];var s=r.instance+"/"+r.symbolizer;e.current&r.zoom&&(!(s in n)||!(r.name in n[s]))&&(e.current&=r.zoom,s in n||(n[s]={}),n[s][r.name]=r)}if(Object.keys(n).length)retur
),n<22&&e.push(" <MinScaleDenominator>"+r.Zoom.ranges[n+1]+"</MinScaleDenominator>\n")}return e},r.Zoom.prototype.toString=function(){var e="";for(var t=0;t<=r.Zoom.maxZoom;t++)e+=this.zoom&1<<t?"X":".";return e}},{"../tree":45}],74:[function(e,t,n){t.exports={_args:[[{raw:"carto@github:cartodb/carto#master",scope:null,escapedName:"carto",name:"carto",rawSpec:"github:cartodb/carto#master",spec:"github:cartodb/carto#master",type:"hosted",hosted:{type:"github",ssh:"git@github.com:cartodb/carto.git#master",sshUrl:"git+ssh://git@github.com/cartodb/carto.git#master",httpsUrl:"git+https://github.com/cartodb/carto.git#master",gitUrl:"git://github.com/cartodb/carto.git#master",shortcut:"github:cartodb/carto#master",directUrl:"https://raw.githubusercontent.com/cartodb/carto/master/package.json"}},"/Users/ruben/Projects/Carto/torque"]],_from:"cartodb/carto#master",_id:"carto@0.15.1-cdb4",_inCache:!0,_location:"/carto",_phantomChildren:{},_requested:{raw:"carto@github:cartodb/carto#master",scope:null,escapedName:"carto",name:"carto",rawSpec:"github:cartodb/carto#master",spec:"github:cartodb/carto#master",type:"hosted",hosted:{type:"github",ssh:"git@github.com:cartodb/carto.git#master",sshUrl:"git+ssh://git@github.com/cartodb/carto.git#master",httpsUrl:"git+https://github.com/cartodb/carto.git#master",gitUrl:"git://github.com/cartodb/carto.git#master",shortcut:"github:cartodb/carto#master",directUrl:"https://raw.githubusercontent.com/cartodb/carto/master/package.json"}},_requiredBy:["/"],_resolved:"git://github.com/cartodb/carto.git#cbe66020f98647429d2bb04b7cf73dcf194f2abf",_shasum:"81502a07a925021884ef159715147788290f7910",_shrinkwrap:null,_spec:"carto@github:cartodb/carto#master",_where:"/Users/ruben/Projects/Carto/torque",author:{name:"CartoDB",url:"http://cartodb.com/"},bin:{carto:"./bin/carto"},bugs:{url:"https://github.com/cartodb/carto/issues"},contributors:[{name:"Tom MacWright",email:"macwright@gmail.com"},{name:"Konstantin Käfer"},{name:"Alexis Sellier",email:"self@cloudhead.net"},{name:"Raul Ochoa",email:"rochoa@cartodb.com"},{name:"Javi Santana",email:"jsantana@cartodb.com"}],dependencies:{"mapnik-reference":"~6.0.2",optimist:"~0.6.0",underscore:"1.8.3"},description:"CartoCSS Stylesheet Compiler",devDependencies:{browserify:"~7.0.0",coveralls:"~2.10.1",istanbul:"~0.2.14",jshint:"0.2.x",mocha:"1.12.x",sax:"0.1.x","uglify-js":"1.3.3"},engines:{node:">=0.4.x"},gitHead:"cbe66020f98647429d2bb04b7cf73dcf194f2abf",homepage:"https://github.com/cartodb/carto#readme",keywords:["maps","css","stylesheets"],licenses:[{type:"Apache"}],main:"./lib/carto/index",man:["./man/carto.1"],name:"carto",optionalDependencies:{},readme:"# CartoCSS\n\n[![Build Status](https://travis-ci.org/CartoDB/carto.png?branch=master)](https://travis-ci.org/CartoDB/carto)\n\nIs as stylesheet renderer for javascript, It's an evolution of the Mapnik renderer from Mapbox.\nPlease, see original [Mapbox repo](http://github.com/mapbox/carto) for more information and credits\n\n## Quick Start\n\n```javascript\n// shader is a CartoCSS object\n\nvar cartocss = [\n '#layer {',\n ' marker-width: [property]',\n ' marker-fill: red',\n '}'\n].join('')\nvar shader = new carto.RendererJS().render(cartocss);\nvar layers = shader.getLayers()\nfor (var i = 0; i < layers.length; ++i) {\n var layer = layers[i];\n console.log(\"layer name: \", layer.fullName())\n console.log(\"- frames: \", layer.frames())\n console.log(\"- attachment: \", layer.attachment())\n\n var layerShader = layer.getStyle({ property: 1 }, { zoom: 10 })\n console.log(layerShader['marker-width']) // 1\n console.log(layerShader['marker-fill']) // #FF0000\n}\n\n```\n\n# API\n\n## RendererJS\n\n### render(cartocss)\n\n## CartoCSS\n\ncompiled cartocss object\n\n### getLayers\n\nreturn the layers, an array of ``CartoCSS.Layer`` object\n\n### getDefault\n\nreturn the default layer (``CartoCSS.Layer``), usually the Map layer\n\n\n### findLayer(where)\n\nfind a layer using where object.\n\n```\nshader.findLayer({ name: 'test' })\n```\n\n## CartoCSS.Layer\n\n### getStyle(props, con
,"#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#
n=t>0,r=w(t)>Lt,i=is(e,6*Pt);return hi(s,o,i,n?[0,-e]:[-Ot,e-Ot])}function Si(e,t,n,r){return function(i){var s=i.a,o=i.b,u=s.x,a=s.y,f=o.x,l=o.y,c=0,h=1,p=f-u,d=l-a,v;v=e-u;if(!p&&v>0)return;v/=p;if(p<0){if(v<c)return;v<h&&(h=v)}else if(p>0){if(v>h)return;v>c&&(c=v)}v=n-u;if(!p&&v<0)return;v/=p;if(p<0){if(v>h)return;v>c&&(c=v)}else if(p>0){if(v<c)return;v<h&&(h=v)}v=t-a;if(!d&&v>0)return;v/=d;if(d<0){if(v<c)return;v<h&&(h=v)}else if(d>0){if(v>h)return;v>c&&(c=v)}v=r-a;if(!d&&v<0)return;v/=d;if(d<0){if(v>h)return;v>c&&(c=v)}else if(d>0){if(v<c)return;v<h&&(h=v)}return c>0&&(i.a={x:u+c*p,y:a+c*d}),h<1&&(i.b={x:u+h*p,y:a+h*d}),i}}function Ti(t,n,r,i){function s(e,i){return w(e[0]-t)<Lt?i>0?0:3:w(e[0]-r)<Lt?i>0?2:1:w(e[1]-n)<Lt?i>0?1:0:i>0?3:2}function o(e,t){return u(e.x,t.x)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}return function(a){function m(e){var t=0,n=p.length,r=e[1];for(var i=0;i<n;++i)for(var s=1,o=p[i],u=o.length,a=o[0],f;s<u;++s)f=o[s],a[1]<=r?f[1]>r&&jt(a,f,e)>0&&++t:f[1]<=r&&jt(a,f,e)<0&&--t,a=f;return t!==0}function g(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do f.point(l===0||l===3?t:r,l>1?i:n);while((l=(l+a+4)%4)!==c)}else f.point(o[0],o[1])}function y(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function b(e,t){y(e,t)&&a.point(e,t)}function L(){v.point=O,p&&p.push(d=[]),C=!0,N=!1,x=T=NaN}function A(){h&&(O(w,E),S&&N&&l.rejoin(),h.push(l.buffer())),v.point=b,N&&a.lineEnd()}function O(e,t){e=Math.max(-xi,Math.min(xi,e)),t=Math.max(-xi,Math.min(xi,t));var n=y(e,t);p&&d.push([e,t]);if(C)w=e,E=t,S=n,C=!1,n&&(a.lineStart(),a.point(e,t));else if(n&&N)a.point(e,t);else{var r={a:{x:x,y:T},b:{x:e,y:t}};c(r)?(N||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),n||a.lineEnd(),k=!1):n&&(a.lineStart(),a.point(e,t),k=!1)}x=e,T=t,N=n}var f=a,l=di(),c=Si(t,n,r,i),h,p,d,v={point:b,lineStart:L,lineEnd:A,polygonStart:function(){a=l,h=[],p=[],k=!0},polygonEnd:function(){a=f,h=e.merge(h);var n=m([t,i]),r=k&&n,s=h.length;if(r||s)a.polygonStart(),r&&(a.lineStart(),g(null,null,1,a),a.lineEnd()),s&&fi(h,o,n,g,a),a.polygonEnd();h=p=d=null}},w,E,S,x,T,N,C,k;return v}}function Ni(e){var t=0,n=Ot/3,r=Qi(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Ot/180,n=e[1]*Ot/180):[t/Ot*180,n/Ot*180]},i}function Ci(e,t){function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),s-n*Math.cos(e)]}var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),s=Math.sqrt(i)/r;return o.invert=function(e,t){var n=s-t;return[Math.atan2(e,n)/r,It((i-(e*e+n*n)*r*r)/(2*r))]},o}function Oi(){function i(e,t){Li+=r*e-n*t,n=e,r=t}var e,t,n,r;Ai.point=function(s,o){Ai.point=i,e=n=s,t=r=o},Ai.lineEnd=function(){i(e,t)}}function Bi(e,t){e<Mi&&(Mi=e),e>Di&&(Di=e),t<_i&&(_i=t),t>Pi&&(Pi=t)}function ji(){function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r),n.point=s}function s(e,n){t.push("L",e,",",n)}function o(){n.point=r}function u(){t.push("Z")}var e=Fi(4.5),t=[],n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(t){return e=Fi(t),n},result:function(){if(t.length){var e=t.join("");return t=[],e}}};return n}function Fi(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function qi(e,t){Vr+=e,$r+=t,++Jr}function Ri(){function n(n,r){var i=n-e,s=r-t,o=Math.sqrt(i*i+s*s);Kr+=o*(e+n)/2,Qr+=o*(t+r)/2,Gr+=o,qi(e=n,t=r)}var e,t;Ii.point=function(r,i){Ii.point=n,qi(e=r,t=i)}}function Ui(){Ii.point=qi}function zi(){function i(e,t){var i=e-n,s=t-r,o=Math.sqrt(i*i+s*s);Kr+=o*(n+e)/2,Qr+=o*(r+t)/2,Gr+=o,o=r*e-n*t,Yr+=o*(n+e),Zr+=o*(r+t),ei+=o*3,qi(n=e,r=t)}var e,t,n,r;Ii.point=function(s,o){Ii.point=i,qi(e=n=s,t=r=o)},Ii.lineEnd=function(){i(e,t)}}function Wi(e){function r(n,r){e.moveTo(n+t,r),e.arc(n,r,t,0,Mt)}function i(t,r){e.moveTo(t,r),n.point=s}function s(t,n){e.lineTo(t,n)}function o(){n.point=r}function u(){e.closePath()}var t=4.5,n={point:r,lineStart:function(){n.point=i},lineE
n/b,x*n/b]]}function Va(e){function u(s){function d(){u.push("M",i(e(a),o))}var u=[],a=[],f=-1,l=s.length,c,h=Cn(t),p=Cn(n);while(++f<l)r.call(this,c=s[f],f)?a.push([+h.call(this,c,f),+p.call(this,c,f)]):a.length&&(d(),a=[]);return a.length&&d(),u.length?u.join(""):null}var t=Ns,n=Cs,r=ai,i=Ja,s=i.key,o=.7;return u.x=function(e){return arguments.length?(t=e,u):t},u.y=function(e){return arguments.length?(n=e,u):n},u.defined=function(e){return arguments.length?(r=e,u):r},u.interpolate=function(e){return arguments.length?(typeof e=="function"?s=i=e:s=(i=$a.get(e)||Ja).key,u):s},u.tension=function(e){return arguments.length?(o=e,u):o},u}function Ja(e){return e.length>1?e.join("L"):e+"Z"}function Ka(e){return e.join("L")+"Z"}function Qa(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r[0]+(r=e[t])[0])/2,"V",r[1]);return n>1&&i.push("H",r[0]),i.join("")}function Ga(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function Ya(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function Za(e,t){return e.length<4?Ja(e):e[1]+nf(e.slice(1,-1),rf(e,t))}function ef(e,t){return e.length<3?Ka(e):e[0]+nf((e.push(e[0]),e),rf([e[e.length-2]].concat(e,[e[1]]),t))}function tf(e,t){return e.length<3?Ja(e):e[0]+nf(e,rf(e,t))}function nf(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return Ja(e);var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;n&&(r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1],i=e[1],a=2);if(t.length>1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++)s=e[a],u=t[f],r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function rf(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a)i=s,s=o,o=e[u],n.push([r*(o[0]-i[0]),r*(o[1]-i[1])]);return n}function sf(e){if(e.length<3)return Ja(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s,"L",ff(hf,o),",",ff(hf,u)];e.push(e[n-1]);while(++t<=n)r=e[t],o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),pf(a,o,u);return e.pop(),a.push("L",r),a.join("")}function of(e){if(e.length<4)return Ja(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3)i=e[n],s.push(i[0]),o.push(i[1]);t.push(ff(hf,s)+","+ff(hf,o)),--n;while(++n<r)i=e[n],s.shift(),s.push(i[0]),o.shift(),o.push(i[1]),pf(t,s,o);return t.join("")}function uf(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4)s=e[n%r],o.push(s[0]),u.push(s[1]);t=[ff(hf,o),",",ff(hf,u)],--n;while(++n<i)s=e[n%r],o.shift(),o.push(s[0]),u.shift(),u.push(s[1]),pf(t,o,u);return t.join("")}function af(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n)a=e[u],f=u/n,a[0]=t*a[0]+(1-t)*(r+f*s),a[1]=t*a[1]+(1-t)*(i+f*o)}return sf(e)}function ff(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function pf(e,t,n){e.push("C",ff(lf,t),",",ff(lf,n),",",ff(cf,t),",",ff(cf,n),",",ff(hf,t),",",ff(hf,n))}function df(e,t){return(t[1]-e[1])/(t[0]-e[0])}function vf(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=df(i,s);while(++t<n)r[t]=(o+(o=df(i=s,s=e[t+1])))/2;return r[t]=o,r}function mf(e){var t=[],n,r,i,s,o=vf(e),u=-1,a=e.length-1;while(++u<a)n=df(e[u],e[u+1]),w(n)<Lt?o[u]=o[u+1]=0:(r=o[u]/n,i=o[u+1]/n,s=r*r+i*i,s>9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function gf(e){return e.length<3?Ja(e):e[0]+nf(e,mf(e))}function yf(e){var t,n=-1,r=e.length,i,s;while(++n<r)t=e[n],i=t[0],s=t[1]-Dt,t[0]=i*Math.cos(s),t[1]=i*Math.sin(s);return e}function bf(e){function c(u){function x(){c.push("M",o(e(p),l),f,a(e(h.reverse()),l),"Z")}var c=[],h=[],p=[],d=-1,v=u.length,m,g=Cn(t),y=Cn(r),b=t===n?function(){return E}:Cn(n),w=r===i?function(){return S}:Cn(i),E,S;while(++d<v)s.call(this,m=u[d],d)?(h.push([E=+g.call(this,m
]};var Wn=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Xn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,qn(t,n))).toFixed(Math.max(0,Math.min(20,qn(t*(1+1e-15),n))))}}),$n=e.time={},Jn=Date;Kn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Qn.setUTCDate.apply(this._,arguments)},setDay:function(){Qn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Qn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Qn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Qn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Qn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Qn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Qn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Qn.setTime.apply(this._,arguments)}};var Qn=Date.prototype;$n.year=Gn(function(e){return e=$n.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),$n.years=$n.year.range,$n.years.utc=$n.year.utc.range,$n.day=Gn(function(e){var t=new Jn(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),$n.days=$n.day.range,$n.days.utc=$n.day.utc.range,$n.dayOfYear=function(e){var t=$n.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=$n[e]=Gn(function(e){return(e=$n.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=$n.year(e).getDay();return Math.floor(($n.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});$n[e+"s"]=n.range,$n[e+"s"].utc=n.utc.range,$n[e+"OfYear"]=function(e){var n=$n.year(e).getDay();return Math.floor(($n.dayOfYear(e)+(n+t)%7)/7)}}),$n.week=$n.sunday,$n.weeks=$n.sunday.range,$n.weeks.utc=$n.sunday.utc.range,$n.weekOfYear=$n.sundayOfYear;var er={"-":"",_:" ",0:"0"},tr=/^\s*\d+/,nr=/^%/;e.locale=function(e){return{numberFormat:zn(e),timeFormat:Zn(e)}};var xr=e.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});e.format=xr.numberFormat,e.geo={},Tr.prototype={s:0,t:0,add:function(e){Cr(e,this.t,Nr),Cr(Nr.s,this.s,this),this.s?this.t+=Nr.t:this.s=Nr.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Nr=new Tr;e.geo.stream=function(e,t){e&&Lr.hasOwnProperty(e.type)?Lr[e.type](e,t):kr(e,t)};var Lr={Feature:function(e,t){kr(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++r<i)kr(n[r].geometry,t)}},Ar={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)e=n[r],t.point(e[0],e[1],e[2])},LineString
z+n(e._,i._));e.parent.A=f(e,i,e.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function f(e,t,r){if(t){var i=e,s=e,o=t,u=i.parent.children[0],a=i.m,f=s.m,l=o.m,c=u.m,h;while(o=Gu(o),i=Qu(i),o&&i)u=Qu(u),s=Gu(s),s.a=e,h=o.z+l-i.z-a+n(o._,i._),h>0&&(Yu(ea(o,e,r),e,h),a+=h,f+=h),l+=o.m,a+=i.m,c+=u.m,f+=s.m;o&&!Gu(s)&&(s.t=o,s.m+=l-f),i&&!Qu(u)&&(u.t=i,u.m+=a-c,r=e)}return r}function l(e){e.x*=r[0],e.y=e.depth*r[1]}var t=e.layout.hierarchy().sort(null).value(null),n=Ku,r=[1,1],i=null;return s.separation=function(e){return arguments.length?(n=e,s):n},s.size=function(e){return arguments.length?(i=(r=e)==null?l:null,s):i?null:r},s.nodeSize=function(e){return arguments.length?(i=(r=e)==null?null:l,s):i?r:null},bu(s,t)},e.layout.cluster=function(){function s(e,s){var o=t.call(this,e,s),u=o[0],a,f=0;Eu(u,function(e){var t=e.children;t&&t.length?(e.x=na(t),e.y=ta(t)):(e.x=a?f+=n(e,a):0,e.y=0,a=e)});var l=ra(u),c=ia(u),h=l.x-n(l,c)/2,p=c.x+n(c,l)/2;return Eu(u,i?function(e){e.x=(e.x-u.x)*r[0],e.y=(u.y-e.y)*r[1]}:function(e){e.x=(e.x-h)/(p-h)*r[0],e.y=(1-(u.y?e.y/u.y:1))*r[1]}),o}var t=e.layout.hierarchy().sort(null).value(null),n=Ku,r=[1,1],i=!1;return s.separation=function(e){return arguments.length?(n=e,s):n},s.size=function(e){return arguments.length?(i=(r=e)==null,s):i?null:r},s.nodeSize=function(e){return arguments.length?(i=(r=e)!=null,s):i?r:null},bu(s,t)},e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function c(e){var t=e.children;if(t&&t.length){var n=s(e),r=[],i=t.slice(),o,u=Infinity,f,h=a==="slice"?n.dx:a==="dice"?n.dy:a==="slice-dice"?e.depth&1?n.dy:n.dx:Math.min(n.dx,n.dy),v;l(i,n.dx*n.dy/e.value),r.area=0;while((v=i.length)>0)r.push(o=i[v-1]),r.area+=o.area,a!=="squarify"||(f=p(r,h))<=u?(i.pop(),u=f):(r.area-=r.pop().area,d(r,h,n,!1),h=Math.min(n.dx,n.dy),r.length=r.area=0,u=Infinity);r.length&&(d(r,h,n,!0),r.length=r.area=0),t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value),o.area=0;while(i=r.pop())o.push(i),o.area+=i.area,i.z!=null&&(d(o,i.z?n.dx:n.dy,n,!r.length),o.length=o.area=0);t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++s<o)l=e[s],l.x=u,l.y=a,l.dy=f,u+=l.dx=Math.min(r.x+r.dx-u,f?n(l.area/f):0);l.z=!0,l.dx+=r.x+r.dx-u,r.y+=f,r.dy-=f}else{if(i||f>r.dx)f=r.dx;while(++s<o)l=e[s],l.x=u,l.y=a,l.dx=f,a+=l.dy=Math.min(r.y+r.dy-a,f?n(l.area/f):0);l.z=!1,l.dy+=r.y+r.dy-a,r.x+=f,r.dx-=f}}function v(e){var n=u||t(e),i=n[0];return i.x=i.y=0,i.value?(i.dx=r[0],i.dy=r[1]):i.dx=i.dy=0,u&&t.revalue(i),l([i],i.dx*i.dy/i.value),(u?h:c)(i),o&&(u=n),n}var t=e.layout.hierarchy(),n=Math.round,r=[1,1],i=null,s=sa,o=!1,u,a="squarify",f=.5*(1+Math.sqrt(5));return v.size=function(e){return arguments.length?(r=e,v):r},v.padding=function(e){function t(t){var n=e.call(v,t,t.depth);return n==null?sa(t):oa(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return oa(t,e)}if(!arguments.length)return i;var r;return s=(i=e)==null?sa:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,v},v.round=function(e){return arguments.length?(n=e?Math.round:Number,v):n!=Number},v.sticky=function(e){return arguments.length?(o=e,u=null,v):o},v.ratio=function(e){return arguments.length?(f=e,v):f},v.mode=function(e){return arguments.length?(a=e+"",v):a},bu(v,t)},e.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=e.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random(
)}var n=e.Promise;if(n&&Object.prototype.toString.call(n.resolve())==="[object Promise]"&&!n.cast)return;e.Promise=ct}var u;Array.isArray?u=Array.isArray:u=function(e){return Object.prototype.toString.call(e)==="[object Array]"};var a=u,f=0,l,c,h=function(t,n){N[f]=t,N[f+1]=n,f+=2,f===2&&(c?c(C):L())},v=typeof window!="undefined"?window:undefined,m=v||{},g=m.MutationObserver||m.WebKitMutationObserver,y=typeof n!="undefined"&&{}.toString.call(n)==="[object process]",b=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined",N=new Array(1e3),L;y?L=w():g?L=S():b?L=x():v===undefined&&typeof e=="function"?L=k():L=T();var O=A,_=M,P=void 0,H=1,B=2,j=new G,Y=new G,rt=nt,st=it,ut=ot,at=0,ct=ht;ht.all=rt,ht.race=st,ht.resolve=_,ht.reject=ut,ht._setScheduler=p,ht._setAsap=d,ht._asap=h,ht.prototype={constructor:ht,then:O,"catch":function(e){return this.then(null,e)}};var pt=dt;dt.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},dt.prototype._enumerate=function(){var e=this.length,t=this._input;for(var n=0;this._state===P&&n<e;n++)this._eachEntry(t[n],n)},dt.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===_){var i=q(e);if(i===O&&e._state!==P)this._settledAt(e._state,t,e._result);else if(typeof i!="function")this._remaining--,this._result[t]=e;else if(n===ct){var s=new n(D);W(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},dt.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===P&&(this._remaining--,e===B?J(r,n):this._result[t]=n),this._remaining===0&&$(r,this._result)},dt.prototype._willSettleAt=function(e,t){var n=this;K(e,undefined,function(e){n._settledAt(H,t,e)},function(e){n._settledAt(B,t,e)})};var mt=vt,gt={Promise:ct,polyfill:mt};typeof define=="function"&&define.amd?define(function(){return gt}):typeof t!="undefined"&&t.exports?t.exports=gt:typeof this!="undefined"&&(this.ES6Promise=gt),mt()}).call(this)}).call(this,e("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{_process:118}],83:[function(e,t,n){n.read=function(e,t,n,r,i){var s,o,u=i*8-r-1,a=(1<<u)-1,f=a>>1,l=-7,c=n?i-1:0,h=n?-1:1,p=e[t+c];c+=h,s=p&(1<<-l)-1,p>>=-l,l+=u;for(;l>0;s=s*256+e[t+c],c+=h,l-=8);o=s&(1<<-l)-1,s>>=-l,l+=r;for(;l>0;o=o*256+e[t+c],c+=h,l-=8);if(s===0)s=1-f;else{if(s===a)return o?NaN:(p?-1:1)*Infinity;o+=Math.pow(2,r),s-=f}return(p?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,u,a,f=s*8-i-1,l=(1<<f)-1,c=l>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,d=r?1:-1,v=t<0||t===0&&1/t<0?1:0;t=Math.abs(t),isNaN(t)||t===Infinity?(u=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+c>=1?t+=h/a:t+=h*Math.pow(2,1-c),t*a>=2&&(o++,a/=2),o+c>=l?(u=0,o=l):o+c>=1?(u=(t*a-1)*Math.pow(2,i),o+=c):(u=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));for(;i>=8;e[n+p]=u&255,p+=d,u/=256,i-=8);o=o<<i|u,f+=i;for(;f>0;e[n+p]=o&255,p+=d,o/=256,f-=8);e[n+p-d]|=v*128}},{}],84:[function(e,t,n){var r=Array.isArray,i=Object.prototype.toString;t.exports=r||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],85:[function(e,t,n){(function(n){"use strict";var r=n.Base64,i="2.1.9",s;if(typeof t!="undefined"&&t.exports)try{s=e("buffer").Buffer}catch(o){}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=function(e){var t={};for(var n=0,r=e.length;n<r;n++)t[e.charAt(n)]=n;return t}(u),f=String.fromCharCode,l=function(e){if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?f(192|t>>>6)+f(128|t&63):f(224|t>>>12&15)+f(128|t>>>6&63)+f(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return f(240|t>>>18&7)+f(128|t>>>12&63)+f(128|t>>>6&63)+f(128|t&63)},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=function(e){return e.replace(c,l)},p=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0),r=[u.charAt(n>>>18),u.charAt(n>>>12
(function(){var e=r.processor.plugins[r.plugin],i=r.run(e);r.plugin+=1,g(i)?i.then(function(){r.asyncTick(t,n)}).catch(function(t){r.handleError(t,e),r.processed=!0,n(t)}):r.asyncTick(t,n)})()}catch(i){this.processed=!0,n(i)}},e.prototype.async=function(){var t=this;return this.processed?new Promise(function(e,n){t.error?n(t.error):e(t.stringify())}):this.processing?this.processing:(this.processing=(new Promise(function(e,n){if(t.error)return n(t.error);t.plugin=0,t.asyncTick(e,n)})).then(function(){return t.processed=!0,t.stringify()}),this.processing)},e.prototype.sync=function(){if(this.processed)return this.result;this.processed=!0;if(this.processing)throw new Error("Use process(css).then(cb) to work with async plugins");if(this.error)throw this.error;for(var t=this.result.processor.plugins,n=Array.isArray(t),r=0,t=n?t:t[Symbol.iterator]();;){var i;if(n){if(r>=t.length)break;i=t[r++]}else{r=t.next();if(r.done)break;i=r.value}var s=i,o=this.run(s);if(g(o))throw new Error("Use process(css).then(cb) to work with async plugins")}return this.result},e.prototype.run=function(t){this.result.lastPlugin=t;try{return t(this.result.root,this.result)}catch(n){throw this.handleError(n,t),n}},e.prototype.stringify=function(){if(this.stringified)return this.result;this.stringified=!0,this.sync();var t=this.result.opts,n=a.default;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);var r=new o.default(n,this.result.root,this.result.opts),i=r.generate();return this.result.css=i[0],this.result.map=i[1],this.result},r(e,[{key:"processor",get:function(){return this.result.processor}},{key:"opts",get:function(){return this.result.opts}},{key:"css",get:function(){return this.stringify().css}},{key:"content",get:function(){return this.stringify().content}},{key:"map",get:function(){return this.stringify().map}},{key:"root",get:function(){return this.sync().root}},{key:"messages",get:function(){return this.sync().messages}}]),e}();n.default=y,t.exports=n["default"]},{"./map-generator":102,"./parse":104,"./result":109,"./stringify":113,"./warn-once":116}],101:[function(e,t,n){"use strict";n.__esModule=!0;var r={split:function i(e,t,n){var r=[],s="",i=!1,o=0,u=!1,a=!1;for(var f=0;f<e.length;f++){var l=e[f];u?a?a=!1:l==="\\"?a=!0:l===u&&(u=!1):l==='"'||l==="'"?u=l:l==="("?o+=1:l===")"?o>0&&(o-=1):o===0&&t.indexOf(l)!==-1&&(i=!0),i?(s!==""&&r.push(s.trim()),s="",i=!1):s+=l}return(n||s!=="")&&r.push(s.trim()),r},space:function(t){var n=[" ","\n"," "];return r.split(t,n)},comma:function s(e){var s=",";return r.split(e,[s],!0)}};n.default=r,t.exports=n["default"]},{}],102:[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var r=e("js-base64"),i=e("source-map"),s=a(i),o=e("path"),u=a(o),l=function(){function e(t,n,r){f(this,e),this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r}return e.prototype.isMap=function(){return typeof this.opts.map!="undefined"?!!this.opts.map:this.previous().length>0},e.prototype.previous=function(){var t=this;return this.previousMaps||(this.previousMaps=[],this.root.walk(function(e){if(e.source&&e.source.input.map){var n=e.source.input.map;t.previousMaps.indexOf(n)===-1&&t.previousMaps.push(n)}})),this.previousMaps},e.prototype.isInline=function(){if(typeof this.mapOpts.inline!="undefined")return this.mapOpts.inline;var t=this.mapOpts.annotation;return typeof t!="undefined"&&t!==!0?!1:this.previous().length?this.previous().some(function(e){return e.inline}):!0},e.prototype.isSourcesContent=function(){return typeof this.mapOpts.sourcesContent!="undefined"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(function(e){return e.withContent()}):!0},e.prototype.clearAnnotation=function(){if(this.mapOpts.annotation===!1)return;var t=undefined;for(var n=this.root.nodes.length-1;n>=0;n--){t=this.root.nodes[n];if(t.type!=="comment")continue;t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}},e.pro
("\n")!==-1&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r=="undefined"&&(r=this.raw(n,null,"beforeRule")),r},e.prototype.rawBeforeRule=function(t){var n=undefined;return t.walk(function(e){if(e.nodes&&(e.parent!==t||t.first!==e)&&typeof e.raws.before!="undefined")return n=e.raws.before,n.indexOf("\n")!==-1&&(n=n.replace(/[^\n]+$/,"")),!1}),n},e.prototype.rawBeforeClose=function(t){var n=undefined;return t.walk(function(e){if(e.nodes&&e.nodes.length>0&&typeof e.raws.after!="undefined")return n=e.raws.after,n.indexOf("\n")!==-1&&(n=n.replace(/[^\n]+$/,"")),!1}),n},e.prototype.rawBeforeOpen=function(t){var n=undefined;return t.walk(function(e){if(e.type!=="decl"){n=e.raws.between;if(typeof n!="undefined")return!1}}),n},e.prototype.rawColon=function(t){var n=undefined;return t.walkDecls(function(e){if(typeof e.raws.between!="undefined")return n=e.raws.between.replace(/[^\s:]/g,""),!1}),n},e.prototype.beforeAfter=function(t,n){var r=undefined;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");var i=t.parent,s=0;while(i&&i.type!=="root")s+=1,i=i.parent;if(r.indexOf("\n")!==-1){var o=this.raw(t,null,"indent");if(o.length)for(var u=0;u<s;u++)r+=o}return r},e.prototype.rawValue=function(t,n){var r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r},e}();n.default=o,t.exports=n["default"]},{}],113:[function(e,t,n){"use strict";function s(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=new i.default(t);n.stringify(e)}n.__esModule=!0,n.default=o;var r=e("./stringifier"),i=s(r);t.exports=n["default"]},{"./stringifier":112}],114:[function(e,t,n){"use strict";function x(e){function q(t){throw e.error("Unclosed "+t,F,I-j)}var t=[],n=e.css.valueOf(),x=undefined,T=undefined,N=undefined,C=undefined,k=undefined,L=undefined,A=undefined,O=undefined,M=undefined,_=undefined,D=undefined,P=undefined,H=undefined,B=n.length,j=-1,F=1,I=0;while(I<B){x=n.charCodeAt(I);if(x===u||x===f||x===c&&n.charCodeAt(I+1)!==u)j=I,F+=1;switch(x){case u:case a:case l:case c:case f:T=I;do T+=1,x=n.charCodeAt(T),x===u&&(j=T,F+=1);while(x===a||x===u||x===l||x===c||x===f);t.push(["space",n.slice(I,T)]),I=T-1;break;case d:t.push(["{","{",F,I-j]);break;case v:t.push(["}","}",F,I-j]);break;case y:t.push([":",":",F,I-j]);break;case m:t.push([";",";",F,I-j]);break;case h:P=t.length?t[t.length-1][1]:"",H=n.charCodeAt(I+1);if(P==="url"&&H!==r&&H!==i&&H!==a&&H!==u&&H!==l&&H!==f&&H!==c){T=I;do{_=!1,T=n.indexOf(")",T+1),T===-1&&q("bracket"),D=T;while(n.charCodeAt(D-1)===s)D-=1,_=!_}while(_);t.push(["brackets",n.slice(I,T+1),F,I-j,F,T-j]),I=T}else T=n.indexOf(")",I+1),L=n.slice(I,T+1),T===-1||S.test(L)?t.push(["(","(",F,I-j]):(t.push(["brackets",L,F,I-j,F,T-j]),I=T);break;case p:t.push([")",")",F,I-j]);break;case r:case i:N=x===r?"'":'"',T=I;do{_=!1,T=n.indexOf(N,T+1),T===-1&&q("quote"),D=T;while(n.charCodeAt(D-1)===s)D-=1,_=!_}while(_);L=n.slice(I,T+1),C=L.split("\n"),k=C.length-1,k>0?(O=F+k,M=T-C[k].length):(O=F,M=j),t.push(["string",n.slice(I,T+1),F,I-j,O,T-M]),j=M,F=O,I=T;break;case b:w.lastIndex=I+1,w.test(n),w.lastIndex===0?T=n.length-1:T=w.lastIndex-2,t.push(["at-word",n.slice(I,T+1),F,I-j,F,T-j]),I=T;break;case s:T=I,A=!0;while(n.charCodeAt(T+1)===s)T+=1,A=!A;x=n.charCodeAt(T+1),A&&x!==o&&x!==a&&x!==u&&x!==l&&x!==c&&x!==f&&(T+=1),t.push(["word",n.slice(I,T+1),F,I-j,F,T-j]),I=T;break;default:x===o&&n.charCodeAt(I+1)===g?(T=n.indexOf("*/",I+2)+1,T===0&&q("comment"),L=n.slice(I,T+1),C=L.split("\n"),k=C.length-1,k>0?(O=F+k,M=T-C[k].length):(O=F,M=j),t.push(["comment",L,F,I-j,O,T-M]),j=M,F=O,I=T):(E.lastIndex=I+1,E.test(n),E.lastIndex===0?T=n.length-1:T=E.lastIndex-2,t.push(["word",n.slice(I,T+1),F,I-j,F,T-j]),I=T)}I++}return t}n.__esModule=!0,n.default=x;var r=39,i=34,s=92,o=47,u=10,a=32,f=12,l=9,c=13,h=40,p=41,d=123,v=125,m=59,g=42,y=58,b=64,w=/[ \n\t\r\f\{\(\)'"\\;/]/g,E=/[ \n\t\r\f\(\)\{\}:;@!'"\\]|\/(?=\*)/g,S=/.[\\\/\("'\n]/;t.exports=n["default"]},{}],115:[function(e,t,n){"use strict";n.__esModule=!0,n.default={prefix:function(t){if(t
n.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},c.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},c.prototype.sourceContentFor=function(t,n){for(var r=0;r<this._sections.length;r++){var i=this._sections[r],s=i.consumer.sourceContentFor(t,!0);if(s)return s}if(n)return null;throw new Error('"'+t+'" is not in the SourceMap.')},c.prototype.generatedPositionFor=function(t){for(var n=0;n<this._sections.length;n++){var i=this._sections[n];if(i.consumer.sources.indexOf(r.getArg(t,"source"))===-1)continue;var s=i.consumer.generatedPositionFor(t);if(s){var o={line:s.line+(i.generatedOffset.generatedLine-1),column:s.column+(i.generatedOffset.generatedLine===s.line?i.generatedOffset.generatedColumn-1:0)};return o}}return{line:null,column:null}},c.prototype._parseMappings=function(t,n){this.__generatedMappings=[],this.__originalMappings=[];for(var i=0;i<this._sections.length;i++){var s=this._sections[i],o=s.consumer._generatedMappings;for(var a=0;a<o.length;a++){var f=o[a],l=s.consumer._sources.at(f.source);s.consumer.sourceRoot!==null&&(l=r.join(s.consumer.sourceRoot,l)),this._sources.add(l),l=this._sources.indexOf(l);var c=s.consumer._names.at(f.name);this._names.add(c),c=this._names.indexOf(c);var h={source:l,generatedLine:f.generatedLine+(s.generatedOffset.generatedLine-1),generatedColumn:f.generatedColumn+(s.generatedOffset.generatedLine===f.generatedLine?s.generatedOffset.generatedColumn-1:0),originalLine:f.originalLine,originalColumn:f.originalColumn,name:c};this.__generatedMappings.push(h),typeof h.originalLine=="number"&&this.__originalMappings.push(h)}}u(this.__generatedMappings,r.compareByGeneratedPositionsDeflated),u(this.__originalMappings,r.compareByOriginalPositions)},n.IndexedSourceMapConsumer=c},{"./array-set":120,"./base64-vlq":121,"./binary-search":123,"./quick-sort":125,"./util":129}],127:[function(e,t,n){function u(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new o,this._sourcesContents=null}var r=e("./base64-vlq"),i=e("./util"),s=e("./array-set").ArraySet,o=e("./mapping-list").MappingList;u.prototype._version=3,u.fromSourceMap=function(t){var n=t.sourceRoot,r=new u({file:t.file,sourceRoot:n});return t.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source!=null&&(t.source=e.source,n!=null&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},e.name!=null&&(t.name=e.name)),r.addMapping(t)}),t.sources.forEach(function(e){var n=t.sourceContentFor(e);n!=null&&r.setSourceContent(e,n)}),r},u.prototype.addMapping=function(t){var n=i.getArg(t,"generated"),r=i.getArg(t,"original",null),s=i.getArg(t,"source",null),o=i.getArg(t,"name",null);this._skipValidation||this._validateMapping(n,r,s,o),s!=null&&(s=String(s),this._sources.has(s)||this._sources.add(s)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:s,name:o})},u.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot!=null&&(r=i.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},u.prototype.applySourceMap=function(t,n,r){var o=n;if(n==null){if(t.file==null)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');o=t.file}var u=this._sourceRoot;u!=null&&(o=i.relative(u,o));var a=new s,f=new s;this._mappings.unsortedForEach(function(e){if(e.source===o&&e.originalLine!=null){var n=t.ori
.is=function(e){return this.constructor===e}},{}],160:[function(e,t,n){"use strict";function o(e){this.datasource=e}e("es6-promise").polyfill();var r=e("postcss-value-parser"),i=e("postcss"),s=e("./fn/builder");t.exports=o,o.prototype.getPlugin=function(e){var t=this;return i.plugin("turbo-carto",function(){return function(n){var i=new s(t.datasource);return n.walkDecls(function(t){var n=r(t.value);n.walk(function(n){if(n.type==="function")return i.add(t,n,e),!1},!1)}),i.exec()}})}},{"./fn/builder":133,"es6-promise":82,postcss:106,"postcss-value-parser":89}],161:[function(e,t,n){"use strict";function o(e,t){this.cartocss=e,this.datasource=t,this.metadataHolder=new s}var r=e("postcss"),i=e("./postcss-turbo-carto"),s=e("./model/metadata-holder");o.prototype.getCartocss=function(e){var t=this,n=new i(this.datasource);r([n.getPlugin(this.metadataHolder)]).process(this.cartocss).then(function(n){e(null,n.css,t.metadataHolder)}).catch(e)},o.prototype.getMetadata=function(e){return e(null,this.metadataHolder)},t.exports=o},{"./model/metadata-holder":157,"./postcss-turbo-carto":160,postcss:106}],162:[function(e,t,n){var r=e("simple-statistics");t.exports=function(e,t,n){var i=[],s=[];return e.features.forEach(function(e){e.properties[t]!==undefined&&i.push(e.properties[t])}),s=r.jenks(i,n),s}},{"simple-statistics":119}],163:[function(e,t,n){(function(){function N(e){function t(t,n,r,i,s,o){for(;s>=0&&s<o;s+=e){var u=i?i[s]:s;r=n(r,t[u],u,t)}return r}return function(n,r,i,s){r=g(r,s,4);var o=!T(n)&&m.keys(n),u=(o||n).length,a=e>0?0:u-1;return arguments.length<3&&(i=n[o?o[a]:a],a+=e),t(n,r,i,o,a,u)}}function L(e){return function(t,n,r){n=y(n,r);var i=x(t),s=e>0?0:i-1;for(;s>=0&&s<i;s+=e)if(n(t[s],s,t))return s;return-1}}function A(e,t,n){return function(r,i,s){var o=0,u=x(r);if(typeof s=="number")e>0?o=s>=0?s:Math.max(s+u,o):u=s>=0?Math.min(s+1,u):s+u+1;else if(n&&s&&u)return s=n(r,i),r[s]===i?s:-1;if(i!==i)return s=t(a.call(r,o,u),m.isNaN),s>=0?s+o:-1;for(s=e>0?o:u-1;s>=0&&s<u;s+=e)if(r[s]===i)return s;return-1}}function D(e,t){var n=_.length,r=e.constructor,i=m.isFunction(r)&&r.prototype||s,o="constructor";m.has(e,o)&&!m.contains(t,o)&&t.push(o);while(n--)o=_[n],o in e&&e[o]!==i[o]&&!m.contains(t,o)&&t.push(o)}var e=this,r=e._,i=Array.prototype,s=Object.prototype,o=Function.prototype,u=i.push,a=i.slice,f=s.toString,l=s.hasOwnProperty,c=Array.isArray,h=Object.keys,p=o.bind,d=Object.create,v=function(){},m=function(e){if(e instanceof m)return e;if(!(this instanceof m))return new m(e);this._wrapped=e};typeof n!="undefined"?(typeof t!="undefined"&&t.exports&&(n=t.exports=m),n._=m):e._=m,m.VERSION="1.8.3";var g=function(e,t,n){if(t===void 0)return e;switch(n==null?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)}}return function(){return e.apply(t,arguments)}},y=function(e,t,n){return e==null?m.identity:m.isFunction(e)?g(e,t,n):m.isObject(e)?m.matcher(e):m.property(e)};m.iteratee=function(e,t){return y(e,t,Infinity)};var b=function(e,t){return function(n){var r=arguments.length;if(r<2||n==null)return n;for(var i=1;i<r;i++){var s=arguments[i],o=e(s),u=o.length;for(var a=0;a<u;a++){var f=o[a];if(!t||n[f]===void 0)n[f]=s[f]}}return n}},w=function(e){if(!m.isObject(e))return{};if(d)return d(e);v.prototype=e;var t=new v;return v.prototype=null,t},E=function(e){return function(t){return t==null?void 0:t[e]}},S=Math.pow(2,53)-1,x=E("length"),T=function(e){var t=x(e);return typeof t=="number"&&t>=0&&t<=S};m.each=m.forEach=function(e,t,n){t=g(t,n);var r,i;if(T(e))for(r=0,i=e.length;r<i;r++)t(e[r],r,e);else{var s=m.keys(e);for(r=0,i=s.length;r<i;r++)t(e[s[r]],s[r],e)}return e},m.map=m.collect=function(e,t,n){t=y(t,n);var r=!T(e)&&m.keys(e),i=(r||e).length,s=Array(i);for(var o=0;o<i;o++){var u=r?r[o]:o;s[o]=t(e[u],u,e)}return s},m.reduce=m.foldl=m.inject=N(1),m.reduceRight=m.foldr=N(-1),m.find=m.detect=function(e,t,n){var r;T(e)?r=m.findIndex(e,t,n):r=m.findKey(e,t,n);if(r!==void 0&&