(function(e){functionr(e,t){if(!t.steps)thrownewError("steps option missing");this.options=t,this.running=!1,this._tick=this._tick.bind(this),this._t0=+(newDate),this.callback=e,this._time=0,_.defaults(this.options,{animationDelay:0,maxDelta:.2,loop:!0}),this.domainInv=torque.math.linear(this.options.animationDelay,this.options.animationDelay+this.options.animationDuration),this.domain=this.domainInv.invert(),this.range=torque.math.linear(0,this.options.steps),this.rangeInv=this.range.invert()}e.torque=e.torque||{};vart=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,16)},n=window.requestAnimationFrame||window.mozCancelAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){cancelTimeout(e)};r.prototype={start:function(){this.running=!0,t(this._tick)},stop:function(){this.pause(),this._time=0;vare=this.range(this.domain(this._time));this.callback(e)},toggle:function(){this.running?this.pause():this.start()},step:function(e){if(arguments.length===0)returnthis.range(this.domain(this._time));this._time=this.domainInv(this.rangeInv(e))},pause:function(){this.running=!1,n(this._tick)},_tick:function(){vare=+(newDate),n=(e-this._t0)*.001;n=Math.min(this.options.maxDelta,n),this._t0=e,this._time+=n;varr=this.range(this.domain(this._time));this.callback(r),r>=this.options.steps&&(this._time=0),this.running&&t(this._tick)}},e.torque.Animator=r})(typeofexports=="undefined"?this:exports),function(e){e.torque=e.torque||{};vart={version:"1.0.0",style:{"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["src","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","darken","lighten"]}},symbolizers:{"*":{"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["src","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","darken","lighten"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},trail:{steps:{css:"trail-steps",type:"float","default-value":1,"default-meaning":"no trail steps",doc:"How many steps of trails are going to be rendered"}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"Theoverallopacityof
(e)}if(typeofgoogle=="undefined"||typeofgoogle.maps=="undefined")return;t.prototype=_.extend({},CanvasLayer.prototype,torque.GMapsTileLoader.prototype,torque.Event,{providers:{sql_api:torque.providers.json,url_template:torque.providers.jsonarray},renderers:{point:torque.renderer.Point,pixel:torque.renderer.Rectangle},initialize:function(){vare=this;this.onTileAdded=this.onTileAdded.bind(this),this.options.ready=function(){e.fire("change:bounds",{bounds:e.provider.getBounds()})},this.provider=newthis.providers[this.options.provider](this.options),this.renderer=newthis.renderers[this.options.renderer](this.getCanvas(),this.options),this._initTileLoader(this.options.map,this.getProjection()),this.cartocss&&this.renderer.setCartoCSS(this.cartocss)},getCanvas:function(){returnthis.canvas},onTileAdded:function(e){vart=this;this.provider.getTileData(e,e.zoom,function(n){t._tileLoaded(e,n),t.redraw()})},render:function(){vare,t,n,r=this.canvas;r.width=r.width;vari=r.getContext("2d");for(einthis._tiles)t=this._tiles[e],n=this.getTilePos(t.coord),i.setTransform(1,0,0,1,n.x,n.y),this.renderer.renderTile(t,this.key,n.x,n.y)},setKey:function(e){this.key=e,this.animator.step(e),this.redraw(),this.fire("change:time",{time:this.getTime(),step:this.key})},setStep:function(e){if(e===undefined||e.length!==undefined)thrownewError("setTime only accept scalars");this.setKey(e)},stepToTime:function(e){if(!this.provider)return0;vart=this.provider.getKeySpan(),n=t.start+(t.end-t.start)*(e/this.options.steps);returnnewDate(n*1e3)},getTime:function(){returnthis.stepToTime(this.key)},setCartoCSS:function(e){returnthis.renderer?(this.renderer.setCartoCSS(e),this.redraw(),this):(this.cartocss=e,this)},redraw:function(){this.scheduleUpdate()}}),n.prototype=_.extend({},CanvasTileLayer.prototype,{providers:{sql_api:torque.providers.json,url_template:torque.providers.JsonArray},renderers:{point:torque.renderer.Point,pixel:torque.renderer.Rectangle},initialize:function(e){vart=this;this.key=0,this.options.renderer=this.options.renderer||"pixel",this.options.provider=this.options.provider||"sql_api",this.provider=newthis.providers[this.options.provider](e),this.renderer=newthis.renderers[this.options.renderer](null,e)},_tileLoaded:function(e,t){e.data=t,this.drawTile(e)},_loadTile:function(e,t,n){varr=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){vart=e.canvas;if(!e.data)return;t.width=t.width,this.renderer.setCanvas(t);varn=this.renderer.accumulate(e.data,this.key);this.renderer.renderTileAccum(n,0,0)},setKey:function(e){this.key=e,this.redraw()},setCartoCSS:function(e){if(!this.renderer)thrownewError("renderer is not valid");returnthis.renderer.setCartoCSS(e)}}),e.torque.GMapsTiledTorqueLayer=n,e.torque.GMapsTorqueLayer=t}(typeofexports=="undefined"?this:exports),L.Mixin.TileLoader={_initTileLoader:function(){this._tiles={},this._tilesToLoad=0,this._map.on({moveend:this._updateTiles},this),this._updateTiles()},_removeTileLoader:function(){map.off({moveend:this._updateTiles},this),this._removeTiles()},_updateTiles:function(){if(!this._map)return;vare=this._map.getPixelBounds(),t=this._map.getZoom(),n=this.options.tileSize;if(t>this.options.maxZoom||t<this.options.minZoom)return;varr=newL.Point(Math.floor(e.min.x/n),Math.floor(e.min.y/n)),i=newL.Point(Math.floor(e.max.x/n),Math.floor(e.max.y/n)),s=newL.Bounds(r,i);this._addTilesFromCenterOut(s),this._removeOtherTiles(s)},_removeTiles:function(e){for(vartinthis._tiles)this._removeTile(t)},_removeOtherTiles:function(e){vart,n,r,i,s,o=this._map.getZoom();for(sinthis._tiles)this._tiles.hasOwnProperty(s)&&(t=s.split(":"),n=parseInt(t[0],10),r=parseInt(t[1],10),i=parseInt(t[2],10),(o!==i||n<e.min.x||n>e.max.x||r<e.min.y||r>e.max.y)&&this._removeTile(s))},_removeTile:function(e){this.fire("tileRemoved",this._tiles[e]),deletethis._tiles[e]},_tileShouldBeLoaded:function(e){return!(e.x+":"+e.y+":"+e.zoominthis._tiles)},_tileLoaded:function(e,t){this._tilesToLoad--,this._tiles[e.x+":"+e.y+":"+e.zoom]