mapcomplete/vendor/P4C.min.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

8 lines
189 KiB
JavaScript
Raw Normal View History

!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.P4C=f()}}(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(_dereq_,module,exports){var SphericalMercator=function(){function isFloat(n){return Number(n)===n&&n%1!==0}function SphericalMercator(options){if(options=options||{},this.size=options.size||256,!cache[this.size]){var size=this.size,c=cache[this.size]={};c.Bc=[],c.Cc=[],c.zc=[],c.Ac=[];for(var d=0;d<30;d++)c.Bc.push(size/360),c.Cc.push(size/(2*Math.PI)),c.zc.push(size/2),c.Ac.push(size),size*=2}this.Bc=cache[this.size].Bc,this.Cc=cache[this.size].Cc,this.zc=cache[this.size].zc,this.Ac=cache[this.size].Ac}var cache={},D2R=Math.PI/180,R2D=180/Math.PI,A=6378137,MAXEXTENT=20037508.342789244;return SphericalMercator.prototype.px=function(ll,zoom){if(isFloat(zoom)){var size=this.size*Math.pow(2,zoom),d=size/2,bc=size/360,cc=size/(2*Math.PI),ac=size,f=Math.min(Math.max(Math.sin(D2R*ll[1]),-.9999),.9999),x=d+ll[0]*bc,y=d+.5*Math.log((1+f)/(1-f))*-cc;return x>ac&&(x=ac),y>ac&&(y=ac),[x,y]}var d=this.zc[zoom],f=Math.min(Math.max(Math.sin(D2R*ll[1]),-.9999),.9999),x=Math.round(d+ll[0]*this.Bc[zoom]),y=Math.round(d+.5*Math.log((1+f)/(1-f))*-this.Cc[zoom]);return x>this.Ac[zoom]&&(x=this.Ac[zoom]),y>this.Ac[zoom]&&(y=this.Ac[zoom]),[x,y]},SphericalMercator.prototype.ll=function(px,zoom){if(isFloat(zoom)){var size=this.size*Math.pow(2,zoom),bc=size/360,cc=size/(2*Math.PI),zc=size/2,g=(px[1]-zc)/-cc,lon=(px[0]-zc)/bc,lat=R2D*(2*Math.atan(Math.exp(g))-.5*Math.PI);return[lon,lat]}var g=(px[1]-this.zc[zoom])/-this.Cc[zoom],lon=(px[0]-this.zc[zoom])/this.Bc[zoom],lat=R2D*(2*Math.atan(Math.exp(g))-.5*Math.PI);return[lon,lat]},SphericalMercator.prototype.bbox=function(x,y,zoom,tms_style,srs){tms_style&&(y=Math.pow(2,zoom)-1-y);var ll=[x*this.size,(+y+1)*this.size],ur=[(+x+1)*this.size,y*this.size],bbox=this.ll(ll,zoom).concat(this.ll(ur,zoom));return"900913"===srs?this.convert(bbox,"900913"):bbox},SphericalMercator.prototype.xyz=function(bbox,zoom,tms_style,srs){"900913"===srs&&(bbox=this.convert(bbox,"WGS84"));var ll=[bbox[0],bbox[1]],ur=[bbox[2],bbox[3]],px_ll=this.px(ll,zoom),px_ur=this.px(ur,zoom),x=[Math.floor(px_ll[0]/this.size),Math.floor((px_ur[0]-1)/this.size)],y=[Math.floor(px_ur[1]/this.size),Math.floor((px_ll[1]-1)/this.size)],bounds={minX:Math.min.apply(Math,x)<0?0:Math.min.apply(Math,x),minY:Math.min.apply(Math,y)<0?0:Math.min.apply(Math,y),maxX:Math.max.apply(Math,x),maxY:Math.max.apply(Math,y)};if(tms_style){var tms={minY:Math.pow(2,zoom)-1-bounds.maxY,maxY:Math.pow(2,zoom)-1-bounds.minY};bounds.minY=tms.minY,bounds.maxY=tms.maxY}return bounds},SphericalMercator.prototype.convert=function(bbox,to){return"900913"===to?this.forward(bbox.slice(0,2)).concat(this.forward(bbox.slice(2,4))):this.inverse(bbox.slice(0,2)).concat(this.inverse(bbox.slice(2,4)))},SphericalMercator.prototype.forward=function(ll){var xy=[A*ll[0]*D2R,A*Math.log(Math.tan(.25*Math.PI+.5*ll[1]*D2R))];return xy[0]>MAXEXTENT&&(xy[0]=MAXEXTENT),xy[0]<-MAXEXTENT&&(xy[0]=-MAXEXTENT),xy[1]>MAXEXTENT&&(xy[1]=MAXEXTENT),xy[1]<-MAXEXTENT&&(xy[1]=-MAXEXTENT),xy},SphericalMercator.prototype.inverse=function(xy){return[xy[0]*R2D/A,(.5*Math.PI-2*Math.atan(Math.exp(-xy[1]/A)))*R2D]},SphericalMercator}();"undefined"!=typeof module&&"undefined"!=typeof exports&&(module.exports=exports=SphericalMercator)},{}],2:[function(_dereq_,module,exports){"use strict";function getLens(b64){var len=b64.length;if(len%4>0)throw new Error("In
this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var i,len=end-start;if(this===target&&start<targetStart&&targetStart<end)for(i=len-1;i>=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<len;++i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),1===val.length){var code=val.charCodeAt(0);code<256&&(val=code)}if(void 0!==encoding&&"string"!=typ
}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],19:[function(_dereq_,module,exports){module.exports=_dereq_("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":20}],20:[function(_dereq_,module,exports){"use strict";function Duplex(options){return this instanceof Duplex?(Readable.call(this,options),Writable.call(this,options),options&&options.readable===!1&&(this.readable=!1),options&&options.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,options&&options.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",onend)):new Duplex(options)}function onend(){this.allowHalfOpen||this._writableState.ended||pna.nextTick(onEndNT,this)}function onEndNT(self){self.end()}var pna=_dereq_("process-nextick-args"),objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};module.exports=Duplex;var util=_dereq_("core-util-is");util.inherits=_dereq_("inherits");var Readable=_dereq_("./_stream_readable"),Writable=_dereq_("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++){var method=keys[v];Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method])}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(value){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=value,this._writableState.destroyed=value)}}),Duplex.prototype._destroy=function(err,cb){this.push(null),this.end(),pna.nextTick(cb,err)}},{"./_stream_readable":22,"./_stream_wri
this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,chunk=null,encoding=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!==chunk&&void 0!==chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||endWritable(this,state,cb)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){this.end(),cb(err)}}).call(this,_dereq_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_dereq_("timers").setImmediate)},{"./_stream_duplex":20,"./internal/streams/destroy":26,"./internal/streams/stream":27,_process:18,"core-util-is":5,inherits:10,"process-nextick-args":17,"safe-buffer":33,timers:36,"util-deprecate":37}],25:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function copyBuffer(src,target,offset){src.copy(target,offset)}var Buffer=_dereq_("safe-buffer").Buffer,util=_dereq_("util");module.exports=function(){function BufferList(){_classCallCheck(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};0===this.length&&(this.tail=entry),this.head=entry,++this.length},BufferList.prototype.shift=function(){if(0!==this.length){var ret=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},BufferList.prototype.clear=function(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},BufferList.prototype.concat=function(n){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var ret=Buffer.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret},BufferList}(),util&&util.inspect&&util.inspect.custom&&(module.exports.prototype[util.inspect.custom]=function(){var obj=util.inspect({length:this.length});return this.constructor.name+" "+obj})},{"safe-buffer":33,util:3}],26:[function(_dereq_,module,exports){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;return readableDestroyed||writableDestroyed?(cb?cb(err):!err||this._writableState&&this._writableState.errorEmitted||pna.nextTick(emitErrorNT,this,err),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err){!cb&&err?(pna.nextTick(emitErrorNT,_this,err),_this._writableState&&(_this._writableState.errorEmitted=!0)):cb&&cb(err)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(self,err){self.emit("error",err)}var pna=_dereq_("process-nextick-args");mo
if(void 0===this.name)throw new TypeError("ctrl.fetcher.mustoverride.getName");if(void 0===this.logoUrl)throw new TypeError("ctrl.fetcher.mustoverride.getLogoUrl");if(void 0===this.homepageUrl)throw new TypeError("ctrl.fetcher.mustoverride.getHomepageUrl");this.options={mindate:null,maxdate:null}}return _createClass(Fetcher,[{key:"requestPictures",value:function(boundingBox,options){throw new TypeError("ctrl.fetcher.mustoverride.requestPictures")}},{key:"requestSummary",value:function(boundingBox,options){throw new TypeError("ctrl.fetcher.mustoverride.requestSummary")}},{key:"requestDetections",value:function(boundingBox,options){throw new TypeError("ctrl.fetcher.mustoverride.requestDetections")}},{key:"tagsToPictures",value:function(tags){throw new TypeError("ctrl.fetcher.mustoverride.tagsToPictures")}},{key:"ajax",value:function(url,type){return new Promise(function(resolve,reject){var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState===XMLHttpRequest.DONE)if(200===xmlhttp.status)try{resolve("json"==type?JSON.parse(xmlhttp.responseText):"json_h"==type?{json:JSON.parse(xmlhttp.responseText),xmlhttp:xmlhttp}:xmlhttp.responseText)}catch(e){reject(e)}else reject(new Error("fetcher.ajax.fail "+xmlhttp.status))},xmlhttp.open("GET",url,!0),xmlhttp.timeout=15e3,xmlhttp.ontimeout=function(){reject(new Error("fetcher.ajax.timeout"))},xmlhttp.send()})}},{key:"ajaxPost",value:function(url,parameters,responseType){return new Promise(function(resolve,reject){var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState===XMLHttpRequest.DONE)if(200===xmlhttp.status)if("json"==responseType)try{resolve(JSON.parse(xmlhttp.responseText))}catch(e){reject(e)}else resolve(xmlhttp.responseText);else reject(new Error("fetcher.ajaxpost.fail"))};var params="";if(parameters)for(var key in parameters)""!=params&&(params+="&"),params+=key+"="+encodeURIComponent(parameters[key]);xmlhttp.open("POST",url,!0),xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xmlhttp.timeout=15e3,xmlhttp.ontimeout=function(){reject(new Error("fetcher.ajax.timeout"))},xmlhttp.send(params)})}},{key:"name",get:function(){throw new TypeError("ctrl.fetcher.mustoverride.getName")}}]),Fetcher}();module.exports=Fetcher},{}],44:[function(_dereq_,module,exports){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),CSVFetcher=_dereq_("./fetchers/CSV"),EventLauncher=_dereq_("./EventLauncher"),FlickrFetcher=_dereq_("./fetchers/Flickr"),LatLng=_dereq_("../model/LatLng"),LatLngBounds=_dereq_("../model/LatLngBounds"),Detection=_dereq_("../model/Detection"),MapillaryFetcher=_dereq_("./fetchers/Mapillary"),OpenStre
}):Promise.reject(new Error("ctrl.fetcher.mapillary.getdetectionsfailed"))})}},{key:"tagsToPictures",value:function(tags){var result=[];return Object.keys(tags).filter(function(k){return k.startsWith("mapillary")}).forEach(function(k){tags[k].split(";").forEach(function(mid){/^[0-9A-Za-z_\-]{22}$/.test(mid.trim())&&result.push("https://images.mapillary.com/"+mid.trim()+"/thumb-2048.jpg")})}),result}},{key:"name",get:function(){return"Mapillary"}},{key:"logoUrl",get:function(){return"https://upload.wikimedia.org/wikipedia/commons/5/51/Mapillary_dotcompass_2019.png"}},{key:"homepageUrl",get:function(){return"https://www.mapillary.com/"}}]),Mapillary}(Fetcher);module.exports=Mapillary},{"../../model/Detection":50,"../../model/LatLng":51,"../../model/LatLngBounds":52,"../../model/Picture":53,"../Fetcher":43,"@mapbox/sphericalmercator":1}],48:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Fetcher=_dereq_("../Fetcher"),LatLng=_dereq_("../../model/LatLng"),LatLngBounds=_dereq_("../../model/LatLngBounds"),Picture=_dereq_("../../model/Picture"),API_URL="https://openstreetcam.org/1.0/",OpenStreetCam=function(_Fetcher){function OpenStreetCam(){return _classCallCheck(this,OpenStreetCam),_possibleConstructorReturn(this,(OpenStreetCam.__proto__||Object.getPrototypeOf(OpenStreetCam)).call(this))}return _inherits(OpenStreetCam,_Fetcher),_createClass(OpenStreetCam,[{key:"requestPictures",value:function(boundingBox,options){var data=Object.assign({picsPerRequest:100,page:0,pictures:[],bbox:new LatLngBounds(boundingBox.getSouthWest().wrap(),boundingBox.getNorthEast().wrap())},this.options,options);return this.download(data)}},{key:"requestSummary",value:function(boundingBox,options){var _this2=this;options=Object.assign({},this.options,options),options.bbox=boundingBox;var url=API_URL+"list/nearby-photos/",params={coordinate:boundingBox.getCenter().lat+","+boundingBox.getCenter().lng,radius:boundingBox.getNorthEast().distanceTo(boundingBox.getSouthWest())/2};return options.mindate&&(params.date=new Date(options.mindate).toISOString().split("T")[0]),this.ajaxPost(url,params,"json").then(function(data){if(null!==data&&void 0!==data.status&&"600"===data.status.apiCode||_this2.fail(null,null,new Error("ctrl.fetcher.openstreetcam.getsummaryfailed")),data.currentPageItems&&data.currentPageItems.length>0){data.currentPageItems.sort(function(a,b){return b.timestamp-a.timestamp});var amount=data.currentPageItems.length,last=1e3*data.currentPageItems[0].timestamp;if(options.maxdate&&last>options.maxdate)for(var i=0;i<data.currentPageItems.length&&last>options.maxdate;)i++,amount--,last=i<data.currentPageItems.length?1e3*data.currentPageItems[i].timestamp:0;return{last:last,amount:amount<1e3?"e"+amount:">1000",bbox:options.bbox.toBBoxString()}}return{amount:"e0",bbox:options.bbox.toBBo
throw new Error("model.picture.invalid.date")}if(null===coords||void 0===coords||"number"!=typeof coords.lat||"number"!=typeof coords.lng)throw new Error("model.picture.invalid.coords");if(this.coordinates=coords,!("string"==typeof provider&&provider.length>0))throw new Error("model.picture.invalid.provider");this.provider=provider,this.author=author||null,this.license=license||null,this.detailsUrl=detailsUrl||null,this.direction="number"==typeof direction&&direction>=0&&direction<360?direction:null,this.osmTags=osmTags||null,this.thumbUrl=thumbUrl||null,this.details=details||{}}return _createClass(Picture,[{key:"lookAlike",value:function(other){return this.coordinates.equals(other.coordinates)&&this.date===other.date&&this.direction===other.direction}}]),Picture}();module.exports=Picture},{}]},{},[40])(40)});