@targomo/core
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -5,3 +5,3 @@ { | ||
"author": "Targomo", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": "MIT", | ||
@@ -44,2 +44,3 @@ "repository": "github:targomo/targomo-js", | ||
"rollup-plugin-commonjs": "^8.2.6", | ||
"rollup-plugin-copy": "^0.2.3", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
@@ -49,3 +50,2 @@ "rollup-plugin-resolve": "0.0.1-predev.1", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"rollup-plugin-copy": "^0.2.3", | ||
"shx": "^0.2.2", | ||
@@ -61,4 +61,5 @@ "ts-jest": "^21.1.4", | ||
"isomorphic-fetch": "^2.2.1", | ||
"whatwg-fetch": "^2.0.3" | ||
"whatwg-fetch": "^2.0.3", | ||
"@types/geojson": "^7946.0.1" | ||
} | ||
} |
/** | ||
* @targomo/core "0.2.0" http://targomo.com | ||
* @targomo/core "0.2.1" http://targomo.com | ||
* The JavaScript (& TypeScript) API for Targomo's time-based access mapping services. | ||
* (c) 2018 Targomo | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.tgm={})}(this,function(t){"use strict";function e(t,e){function i(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function i(t,e,i,n){return new(i||(i=Promise))(function(r,s){function o(t){try{u(n.next(t))}catch(t){s(t)}}function a(t){try{u(n.throw(t))}catch(t){s(t)}}function u(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(o,a)}u((n=n.apply(t,e||[])).next())})}function n(t,e){function i(i){return function(o){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[0,s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(s=a.trys,!(s=s.length>0&&s[s.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,o])}}var n,r,s,o,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o}function r(t,e){return new b}function s(t,e){var i=D*t.lat,n=D*t.lng,r=D*e.lat,s=D*e.lng;return Math.acos(Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos(n-s))*x}function o(t,e){e*=1e3;var i=t.lat,n=t.lng,r=i*D,s=e/1e3/110.574235,o=e/1e3/(110.572833*Math.cos(r));return{northEast:{lat:i+s,lng:n+o},southWest:{lat:i-s,lng:n-o}}}function a(t){switch(t.travelType){case"walk":return 10;case"bike":return 25;case"transit":return 150;default:return 120}}function u(t,e,i){return e instanceof Array?c(t,e,i).filter(function(t){return!e.some(function(e){return e==t})}):c(t,e,i).filter(function(t){return e!=t})}function c(t,e,i){return e instanceof Array?t.filter(function(t){return e.some(function(e){return s(t,e)<=i})}):t.filter(function(t){return s(t,e)<=i})}function l(t,e){var i=_.unproject(t);return void 0!=e?{lat:i.lat,lng:i.lng,elevation:e}:i}function h(t){var e=t.lat,i=t.lon;return void 0===e&&t.center&&(e=t.center.lat,i=t.center.lon),new K(t.id,i,e,t.tags)}!function(t){function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function i(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return d.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function s(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function o(t){return new Promise(function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}})}function a(t){var e=new FileReader,i=o(e);return e.readAsArrayBuffer(t),i}function u(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(d.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(d.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(d.arrayBuffer&&d.blob&&m(t))this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!d.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!v(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=u(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d.blob&&(this.blob=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(a)}),this.text=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=o(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n<e.length;n++)i[n]=String.fromCharCode(e[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t,e){var i=(e=e||{}).body;if(t instanceof l){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=function(t){var e=t.toUpperCase();return g.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(r))}}),e}function f(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var d={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(d.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},v=ArrayBuffer.isView||function(t){return t&&p.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,n){t=e(t),n=i(n);var r=this.map[t];this.map[t]=r?r+","+n:n},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,n){this.map[e(t)]=i(n)},r.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,i){t.push(i)}),n(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,i){t.push([i,e])}),n(t)},d.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this,{body:this._bodyInit})},c.call(l.prototype),c.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},f.error=function(){var t=new f(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];f.redirect=function(t,e){if(-1===y.indexOf(e))throw new RangeError("Invalid status code");return new f(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=l,t.Response=f,t.fetch=function(t,e){return new Promise(function(i,n){var s=new l(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:function(t){var e=new r;return t.split(/\r?\n/).forEach(function(t){var i=t.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();e.append(n,r)}}),e}(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;i(new f(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(s.method,s.url,!0),"include"===s.credentials&&(o.withCredentials=!0),"responseType"in o&&d.blob&&(o.responseType="blob"),s.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===s._bodyInit?null:s._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:window);var f=function(){return function(t){this.serverUrl="https://api.targomo.com",this.statisticsUrl="https://api.targomo.com/statistics",this.tilesUrl="https://api.targomo.com/vector-statistics",this.poiUrl="https://api.targomo.com/pointofinterest",this.mapTilesUrl="https://maps.targomo.com",this.photonGeocoderUrl="https://api.targomo.com/geocode",this.overpassUrl="https://api.targomo.com/overpass",Object.assign(this,t)}}(),d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},p=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},m=function(){return function(t,e,i,n){this.value=t,this.key=e,this.previous=i,this.next=n}}(),v=function(){function t(t){void 0===t&&(t=0),this.capacity=t,this.map={},this.size=0}return t.prototype.get=function(t,e){return i(this,void 0,void 0,function(){var i,r,s,o,a,u;return n(this,function(n){switch(n.label){case 0:if(void 0===(i=this.map[t]))return[3,5];this.oldest==i&&i.next&&(this.oldest=i.next),i.next&&(i.next.previous=i.previous),i.previous&&(i.previous.next=i.next),i.previous=this.newest,i.next=null,this.newest=i,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i.value];case 2:return[2,n.sent()];case 3:return r=n.sent(),this.map[t]=void 0,[2,this.get(t,e)];case 4:return[3,8];case 5:return e?(s=e(),o=this.map[t]=new m(s,t,this.newest,null),[4,s]):[3,7];case 6:return a=n.sent(),this.newest&&(this.newest.next=o),this.newest=o,this.capacity&&(this.size>=this.capacity?(u=this.oldest)&&(this.oldest=u.next,delete this.map[u.key]):this.size++),this.oldest||(this.oldest=this.newest),[2,a];case 7:return[2,void 0];case 8:return[2]}})})},t}(),g=function(){function t(){this.map={}}return t.prototype.get=function(t,e){return i(this,void 0,void 0,function(){var i,r;return n(this,function(n){switch(n.label){case 0:return i="string"==typeof t?t:JSON.stringify(t),void 0==this.map[i]?[3,1]:[2,this.map[i]];case 1:return[4,e()];case 2:return r=n.sent(),this.map[i]=r,[2,r]}})})},t}(),y=new g,b=function(){function t(){}return t.prototype.fetch=function(t,e,r,s){return void 0===e&&(e="GET"),void 0===s&&(s={}),i(this,void 0,void 0,function(){var i,o,a,u,c,l,h,f,d,p;return n(this,function(n){switch(n.label){case 0:return i=e,"JSONP"!==e?s.Accept=s.Accept?s.Accept:"application/json":i="GET","POST-RAW"===e&&(i="POST"),"PUT"!==i&&"POST"!==i||(s["Content-Type"]="application/json"),o={method:i,headers:new Headers(s)},"POST-RAW"===e?o.body=r:"GET"!==e&&"JSONP"!==e&&(o.body=JSON.stringify(r)),[4,fetch(t,o)];case 1:return(a=n.sent()).status>=400?"application/json"!==a.headers.get("content-type")?[3,3]:(h=(l=JSON).stringify,[4,a.text()]):[3,6];case 2:return c=h.apply(l,[n.sent(),null,2]),[3,5];case 3:return[4,a.text()];case 4:c=n.sent(),n.label=5;case 5:throw u=c,console.error("[ERROR] in service request\n status = "+a.status+" "+a.statusText+"\n url = "+t+"\n body = "+u),new Error(u);case 6:return"JSONP"!==e?[3,8]:[4,a.text()];case 7:return f=n.sent(),d=f.indexOf("("),p=f.lastIndexOf(")"),d>-1&&p>-1?[2,JSON.parse(f.substring(d+1,p))]:[2,JSON.parse(f)];case 8:return[2,a.json()];case 9:return[2]}})})},t.prototype.fetchData=function(t,e,r,s){return void 0===e&&(e="GET"),i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.fetch(t,e,r,s)];case 1:return(i=n.sent()).data?[2,i.data]:(console.warn("No data object was transmitted by "+t+" \nReturning raw response"),[2,i])}})})},t.prototype.fetchCached=function(t,e,i,n,r){var s=this;if(void 0===i&&(i="GET"),!1!==t){!0!==t&&t||(t=y);var o=JSON.stringify({url:e,method:i,payload:n});return t.get(o,function(){return s.fetch(e,i,n,r)})}return this.fetch(e,i,n)},t.prototype.fetchCachedData=function(t,e,i,n,r){var s=this;if(void 0===i&&(i="GET"),!1!==t){!0!==t&&t||(t=y);var o=JSON.stringify({url:e,method:i,payload:n});return t.get(o,function(){return s.fetchData(e,i,n,r)})}return this.fetchData(e,i,n,r)},t}(),S=function(){function t(t){this.client=t}return t.prototype.fetch=function(t,e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return i={west:s.southWest.lng,south:s.southWest.lat,east:s.northEast.lng,north:s.northEast.lat},o={bounds:i,benchmarks:e.map(function(t){return{source:t.source,minEnd:t.minEnd,minStart:t.minStart,factor:t.factor}})},a=this.client.config.tilesUrl+"/benchmarks/scores_cumulative/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(a,"POST",o)];case 1:return[2,n.sent()]}})})},t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return e=this.client.config.tilesUrl+"/benchmarks/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,i.sent()]}})})},t}();!function(t){t.queryToString=function(t){var e=[];for(var i in t){var n=t[i];void 0!==n&&e.push(i+"="+encodeURIComponent(n))}return e.join("&")},t.buildTargomoUrl=function(t,e,i,n){return void 0===n&&(n=!0),"/"!==t[t.length-1]&&(t+="/"),t+(n?"v1/":"")+e+"?key="+i}}(t.UrlUtil||(t.UrlUtil={}));var T=function(){function e(){}return e.prototype.geocode=function(e,s,o,a,u){return i(this,void 0,void 0,function(){var i,o,c,l;return n(this,function(n){switch(n.label){case 0:return i={singleLine:e,f:"json",countryCode:a,maxLocations:5},s&&(i.location=s.lng+","+s.lat),u&&(i.magicKey=u),o="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?"+t.UrlUtil.queryToString(i),[4,r().fetch(o)];case 1:return c=n.sent(),l=c.candidates.map(function(t){return{lat:t.location.y,lng:t.location.x,description:t.address}}),[2,l]}})})},e.prototype.suggest=function(e,s,o,a,u){return void 0===u&&(u=5),i(this,void 0,void 0,function(){var i,o;return n(this,function(n){switch(n.label){case 0:return i={text:e,f:"json",countryCode:a,maxSuggestions:u},s&&(i.location=s.lng+","+s.lat),[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?"+t.UrlUtil.queryToString(i))];case 1:return o=n.sent(),[2,o.suggestions]}})})},e.prototype.reverseGeocode=function(e,s){return i(this,void 0,void 0,function(){var i,s,o;return n(this,function(n){switch(n.label){case 0:return i={f:"json"},i.location=e.lng+","+e.lat,[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?"+t.UrlUtil.queryToString(i))];case 1:return(s=n.sent())&&s.address?(o={address:s.address.Match_addr,city:s.address.City,countryCode:s.address.CountryCode,location:s.address.Loc_name,region:s.address.Region,subregion:s.address.Subregion,zip:s.address.Postal},[2,o]):[2,{}]}})})},e}(),w=function(){function t(t){this.client=t}return t.prototype.geocode=function(t,e,s){return i(this,void 0,void 0,function(){var i,o,a,u,c=this;return n(this,function(n){switch(n.label){case 0:return i=this.client.config.photonGeocoderUrl,o=i+"/api/?q="+encodeURIComponent(t)+"&limit=5",e&&(o+="&lat="+e.lat+"&lon="+e.lng),s&&(o+="&lang="+encodeURIComponent(s)),[4,r().fetch(o)];case 1:return(a=n.sent()).features.forEach(function(t,e,i){"boundary"==t.properties.osm_key&&i.splice(e,1)}),u=a.features.map(function(t){return t.value=t.properties.osm_id,t.description=c.buildPlaceDescription(t.properties),t}),[2,u]}})})},t.prototype.buildPlaceDescription=function(t){var e=function(t,e){return void 0===e&&(e=" "),t.filter(function(t){return!!t}).join(e).trim()},i=function(i,n){return e(i.map(function(e){return t[e]}),n)},n=i(["street","housenumber"]," "),r=e([i(["postcode","city"]," "),t.country],", "),s={title:"",meta1:"",meta2:"",full:""};return void 0!==t.name?(s.title=t.name,s.meta1=n,s.meta2=r):(s.title=n,s.meta1=r),t.name!==n&&(s.full=s.title),s.meta1&&t.name!==n&&(s.full+=", "+s.meta1),s.meta1&&t.name===n&&(s.full+=s.meta1),s.full=e([s.full,s.meta2],", "),s},t}(),U=function(){return function(t,e,i,n){var r=this;if(this.sources={},this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.time=this.transitFrameDate,this.date=this.transitFrameTime,this.travelType=n.travelType,this.maxEdgeWeight=n.maxEdgeWeight,this.edgeWeight=n.edgeWeight,this.date=this.transitFrameDate=n.transitFrameDate,this.time=this.transitFrameTime=n.transitFrameTime,this.transitFrameDuration=n.transitFrameDuration,null!=n.transitFrameDateTime){var s=new Date(n.transitFrameDateTime),o=s?1e4*s.getFullYear()+100*(s.getMonth()+1)+s.getDate():void 0,a=s?3600*s.getHours()+60*s.getMinutes():void 0;this.date=this.transitFrameDate=o||this.transitFrameDate,this.time=this.transitFrameTime=a||this.transitFrameTime}this.description=n.description||"",this.maxEdgeWeight=n.maxEdgeWeight,this.serviceUrl=t,this.serviceKey=e,this.email=n.email||"developers@targomo.com",this.sendMail=!1,this.callbackUrl=n.callbackUrl||"https://localhost/",this.useCache=n.useCache,this.pointsPerSolution=n.pointsPerSolution,this.maxSolutions=n.maxSolutions||1,this.statisticGroupId=n.statisticGroup,n.statistic instanceof Number||"number"==typeof n.statistic?this.statisticId=+n.statistic:this.statisticId=n.statistic.id,i.forEach(function(t){r.sources[t.id]={id:t.id,x:t.lng,y:t.lat}})}}(),E=function(){return function(t,e,i){if(this.inactiveSources=[],this.sources=[],this.getClosestSources=!1,this.intersectionMode="union",this.appendTravelTimes=!1,this.date=i.transitFrameDate||20170801,this.time=i.transitFrameTime||39600,null!=i.transitFrameDateTime){var n=new Date(i.transitFrameDateTime),r=n?1e4*n.getFullYear()+100*(n.getMonth()+1)+n.getDate():void 0,s=n?3600*n.getHours()+60*n.getMinutes():void 0;this.date=this.date=r||this.date,this.time=this.time=s||this.time}this.edgeWeight=void 0==i.edgeWeight?"time":i.edgeWeight,this.useCache=void 0==i.useCache||i.useCache,this.travelType=i.travelType,this.intersectionMode=i.intersectionMode||"union",this.sources=e.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}),i.inactiveSources&&(this.inactiveSources=i.inactiveSources.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}));var o=[];i.statistics&&(this.omitIndividualStatistics=i.omitIndividualStatistics,o=i.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id})),this.statisticGroupId=+i.statisticsGroup,this.statisticIds=o,this.maxEdgeWeight=i.maxEdgeWeight,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,i.closestSources&&(this.getClosestSources=!0),i.walkSpeed&&(this.walkDownhill=i.walkSpeed.downhill,this.walkSpeed=i.walkSpeed.speed,this.walkUphill=i.walkSpeed.uphill),i.bikeSpeed&&(this.bikeDownhill=i.bikeSpeed.downhill,this.bikeSpeed=i.bikeSpeed.speed,this.bikeUphill=i.bikeSpeed.uphill)}}(),C=function(){return function(){}}(),A=function(){return function(){}}();!function(t){t[t.GERMANY_ZENSUS_100M_STATISTICS=9]="GERMANY_ZENSUS_100M_STATISTICS",t[t.GERMANY_ZENSUS_200M_STATISTICS=2]="GERMANY_ZENSUS_200M_STATISTICS",t[t.GERMANY_ZENSUS_500M_STATISTICS=11]="GERMANY_ZENSUS_500M_STATISTICS",t[t.GERMANY_ZENSUS_1000M_STATISTICS=3]="GERMANY_ZENSUS_1000M_STATISTICS",t[t.GERMANY_ZENSUS_2000M_STATISTICS=10]="GERMANY_ZENSUS_2000M_STATISTICS",t[t.NORWAY_STATISTICS=4]="NORWAY_STATISTICS",t[t.CENSUS_BRANDENBURG_POPULATION=12]="CENSUS_BRANDENBURG_POPULATION",t[t.CANADA_BLOCK_STATISTICS=8]="CANADA_BLOCK_STATISTICS",t[t.CANADA_AREA_STATISTICS=5]="CANADA_AREA_STATISTICS",t[t.BERLIN_STATISTICS=6]="BERLIN_STATISTICS"}(t.StatisticsGroups||(t.StatisticsGroups={}));var I=function(){return function(){}}(),R=function(){return function(t){this.values=t,this.total=0;for(var e in this.values)this.total+=this.values[e]}}();!function(t){t[t.SRID_3857=3857]="SRID_3857",t[t.SRID_4326=4326]="SRID_4326"}(t.SRID||(t.SRID={})),function(t){t.NONE="none",t.SUM="sum",t.MAX="max",t.MIN="min",t.MEAN="mean",t.MEDIAN="median",t.NEAREST="nearest"}(t.MultigraphRequestAggregation||(t.MultigraphRequestAggregation={}));var _=new(function(){function t(){this.R=6378137}return t.prototype.project=function(t){var e=Math.PI/180,i=Math.max(Math.min(Math.sin(t.lat*e),1-1e-15),-(1-1e-15));return{x:this.R*t.lng*e,y:this.R*Math.log((1+i)/(1-i))/2}},t.prototype.unproject=function(t){var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,lng:t.x*e/this.R}},t}()),x=6371.01,D=Math.PI/180,M=Object.freeze({contains:function(t,e){return e.lat>=t.southWest.lat&&e.lat<=t.northEast.lat&&e.lng>=t.southWest.lng&&e.lng<=t.northEast.lng},calculateDistance:s,boundingBox:o,locationsWithinTravelOptions:function(t,e,i){var n,r=i.maxEdgeWeight;switch(i.travelType){case"walk":n=10;break;case"bike":n=25;break;case"transit":n=150;break;default:n=120}return u(t,e,"distance"===i.edgeWeight?Math.round(r/1e3):n*r/3600)},boundingBoxWithinTravelOptions:function(t,e){var i=e.maxEdgeWeight,n=a(e);return o(t,"distance"===e.edgeWeight?Math.round(i/1e3):n*i/3600)},boundingBoxFromLocationArray:function(t){return t.reduce(function(t,e){return t.northEast.lat=e.lat>t.northEast.lat?e.lat:t.northEast.lat,t.northEast.lng=e.lng>t.northEast.lng?e.lng:t.northEast.lng,t.southWest.lat=e.lat<t.southWest.lat?e.lat:t.southWest.lat,t.southWest.lng=e.lng<t.southWest.lng?e.lng:t.southWest.lng,t},{northEast:{lat:t[0].lat,lng:t[0].lng},southWest:{lat:t[0].lat,lng:t[0].lng}})},boundingBoxListWithinTravelOptions:function(t,e){var i=e.maxEdgeWeight,n=a(e),r="distance"===e.edgeWeight?Math.round(i/1e3):n*i/3600,s={northEast:{lat:-1/0,lng:-1/0},southWest:{lat:1/0,lng:1/0}};return t.forEach(function(t){var e=o(t,r);s.northEast.lat=Math.max(s.northEast.lat,e.northEast.lat),s.northEast.lng=Math.max(s.northEast.lng,e.northEast.lng),s.southWest.lat=Math.min(s.southWest.lat,e.southWest.lat),s.southWest.lng=Math.min(s.southWest.lng,e.southWest.lng)}),s},locationsWithinDistance:u,locationsWithinDistanceInclusive:c,webMercatorToLatLng:l,latLngToWebMercator:function(t){return _.project(t)}}),O=function(){return function(t,e){var i=this;this.points=[],this.type=e.type,this.travelTime=e.travelTime,this.distance=e.length/1e3,this.warning=e.warning,this.elevationGain=e.elevationGain,this.transitSegment=!1,this.startName=e.startname,this.endName=e.endname,e.points.forEach(function(t){i.points.push(l({x:t[1],y:t[0]},t[2]))}),e.isTransit&&(this.transitSegment=!0,this.routeType=e.routeType,this.routeShortName=e.routeShortName,this.startName=e.startname,this.endName=e.endname,this.departureTime=e.departureTime,this.arrivalTime=e.arrivalTime,this.tripHeadSign=e.tripHeadSign)}}(),P=function(){function t(t,e,i,n){var r=this;this.travelTime=e,this.routeSegments=[],this.targetHeight=void 0,this.sourceHeight=void 0,this.sourceId=void 0,this.targetId=void 0,this.length=void 0;var s=0,o=[];i.reverse().forEach(function(e){var i=new O(t,e);r.routeSegments.push(i),"TRANSFER"===i.type&&s++,o=o.concat(i.points.reverse())}),this.points=o,this.transfers=s,void 0!==n&&(this.sourceId=n.source_id,this.targetId=n.target_id,this.length=n.length);var a=this.calculateElevationDifferences(this.points);this.targetHeight=a.targetHeight,this.sourceHeight=a.sourceHeight,this.uphillMeter=a.uphillMeter,this.downhillMeter=a.downhillMeter,this.totalElevationDifference=Math.abs(this.sourceHeight-this.targetHeight),this.departureTime=this.calculateDepartureTime(),this.arrivalTime=this.calculateArrivalTime(),this.distance=this.calculateDistance(),this.elevationGain=this.calculateElevationGain()}return t.prototype.calculateDistance=function(){for(var t=0,e=0;e<this.routeSegments.length;e++)t+=this.routeSegments[e].distance;return t},t.prototype.calculateElevationGain=function(){for(var t=void 0,e=0;e<this.routeSegments.length;e++)isFinite(this.routeSegments[e].elevationGain)&&(t=(t||0)+this.routeSegments[e].elevationGain);return t},t.prototype.calculateElevationDifferences=function(t){for(var e=void 0,i=void 0,n=void 0,r=0,s=0,o=this.points.length-1;o>=0;o--)0==o&&(i=this.points[o].elevation),o==this.points.length-1&&(n=this.points[o].elevation),void 0!==e&&(e>this.points[o].elevation?r+=e-this.points[o].elevation:e<this.points[o].elevation&&(s+=this.points[o].elevation-e)),e=this.points[o].elevation;return{targetHeight:i,sourceHeight:n,uphillMeter:r,downhillMeter:s}},t.prototype.calculateDepartureTime=function(){for(var t=0,e=0;e<this.routeSegments.length;e++){var i=this.routeSegments[e];if(null!=i.departureTime)return i.departureTime-t;t+=i.travelTime||0}},t.prototype.calculateArrivalTime=function(){for(var t=0,e=this.routeSegments.length-1;e>=0;e--){var i=this.routeSegments[e];if(null!=i.arrivalTime)return i.arrivalTime-t;t+=i.travelTime||0}},t}(),N=function(){return function(t,e){function i(t){for(var i={},n=0,r=e;n<r.length;n++){var s=r[n];i[s.name]=new R(t[s.id])}return i}var n={};if(t.individualStatistics)for(var r in t.individualStatistics)t.individualStatistics[r]&&t.individualStatistics[r].statistics&&(n[r]=i(t.individualStatistics[r].statistics));this.statistics=i(t.statistics),this.individualStatistics=n,this.raw=t}}();!function(t){t.CREATED="CREATED",t.ROUTING="ROUTING",t.MERGING="MERGING",t.AGGREGATING="AGGREGATING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"}(t.MultigraphStatus||(t.MultigraphStatus={}));var G=function(){return function(t){this.raw=t,this.id=t.id,this.maxPossibleValue=t.maxPossibleValue,this.solutions=t.simulationResults.map(function(t){var e={};return t.sourcePoints.forEach(function(t){e[t.id]=t.optimal}),{id:t.id,startTime:t.startTime,endTime:t.endTime,maxValue:t.maxValue,numberOfDesiredPoints:t.numberOfDesiredPoints,sources:e}})}}(),W=function(){return function(t,e){this.values={};var i={};e.forEach(function(t){i[t.id]=t.name}),this.raw=t;var n=this.values;for(var r in t){var s=t[r],o=(s.aggregation||"").toLowerCase();n[o]=n[o]||{};var a=i[s.statisticId];n[o][a]={value:s.value}}}}(),B=function(){function t(t){if(this.closestSources=!1,this.requestTimeout=null,this.walkSpeed={},this.bikeSpeed={},this.sources=[],this.targets=[],this.rushHour=!1,this.reverse=!1,this.recommendations=!1,this.pathSerializer="compact",this.polygonSerializer="json",this.pointReduction=!0,this.maxEdgeWeight=1800,this.travelType="bike",this.travelSpeed="medium",this.edgeWeight="time",this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.date=this.transitFrameDate,this.time=this.transitFrameTime,this.elevation=!0,this.useCache=!0,this.travelEdgeWeights=null,Object.assign(this,t),null!=t.transitFrameDateTime){var e=new Date(t.transitFrameDateTime),i=e?1e4*e.getFullYear()+100*(e.getMonth()+1)+e.getDate():void 0,n=e?3600*e.getHours()+60*e.getMinutes():void 0;this.date=this.transitFrameDate=i||this.transitFrameDate,this.time=this.transitFrameTime=n||this.transitFrameTime}}return t.prototype.buildTargetsCfg=function(t){return t.map(function(t){return{lat:t.lat,lng:t.lng,id:t.id}})},t.prototype.buildSourcesCfg=function(t){var e=this;return t.map(function(t){var i={lat:t.lat,lng:t.lng,id:t.id,tm:t.tm};if(!i.tm)switch(e.travelType){case"car":i.tm={car:e.rushHour?{rushHour:e.rushHour}:{}};break;case"walk":i.tm={walk:e.walkSpeed};break;case"bike":i.tm={bike:e.bikeSpeed};break;case"transit":i.tm={transit:{frame:{date:e.transitFrameDate,time:e.transitFrameTime},duration:e.transitFrameDuration}}}return i})},t}(),F=function(){return function(){this.minPolygonHoleSize=1e7,this.buffer=50,this.simplify=50,this.srid=t.SRID.SRID_4326,this.quadrantSegments=2,this.intersectionMode="union",this.decimalPrecision=6}}(),k=function(t){function i(e,i,n){var r=t.call(this,n)||this;return r.polygon=new F,r.sources=r.buildSourcesCfg(i),r.polygon.values=n.travelEdgeWeights,r.polygon.serializer=n.serializer,r.polygon.simplify=n.simplifyMeters,r.polygon.srid=n.srid,r.polygon.buffer=n.buffer,r.polygon.minPolygonHoleSize=n.minPolygonHoleSize,r.polygon.quadrantSegments=n.quadrantSegments,r.polygon.intersectionMode=n.intersectionMode,r}return e(i,t),i}(B),j=function(t){function i(e,i,n){var r=t.call(this,n)||this;return r.osmTypes=[],r.sources=r.buildSourcesCfg([i]),r.osmTypes=n.osmTypes,r.serviceKey=e.serviceKey,r.serviceUrl=e.serviceUrl,r}return e(i,t),i}(B),L=function(t){function i(e,i,n,r){var s=t.call(this,r)||this;return s.sources=s.buildSourcesCfg(i),s.targets=s.buildTargetsCfg(n),null!=r.intersectionMode&&(s.polygon={intersectionMode:r.intersectionMode}),s}return e(i,t),i}(B),H=function(t){function i(e,i,n){var r=t.call(this,e,i,n)||this;return delete r.inactiveSources,delete r.statisticGroupId,delete r.statisticIds,delete r.getClosestSources,delete r.useCache,n&&(r.multiGraphSerializationType=n.serialization&&n.serialization.type,r.multiGraphSerializationDecimalPrecision=n.serialization&&n.serialization.decimalPrecision,n.aggregation&&(r.multiGraphAggregationType=n.aggregation.type||null,r.multiGraphAggregationIgnoreOutlier=n.aggregation.ignoreOutliers||null,r.multiGraphAggregationMinSourcesRatio=n.aggregation.minSourcesRatio||null,r.multiGraphAggregationMinSourcesCount=n.aggregation.minSourceCount||null,r.multiGraphAggregationMaxResultValueRatio=n.aggregation.maxResultValueRatio||null,r.multiGraphAggregationMaxResultValue=n.aggregation.maxResultValue||null)),r}return e(i,t),i}(E),q=function(){function e(t){this.client=t}return e.prototype.create=function(e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph",this.client.serviceKey,!1),o=new H(this.client,e,s),[4,r(this.client).fetchCachedData(s.useClientCache,i,"POST",o,{Accept:"text/plain"})];case 1:return a=n.sent(),[2,a]}})})},e.prototype.info=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e,this.client.serviceKey,!1),[4,r(this.client).fetch(i,"GET")];case 1:return(s=n.sent()).boundingBoxNorthEast&&s.boundingBoxSouthWest&&(s.boundingBox={northEast:{lat:s.boundingBoxNorthEast.y,lng:s.boundingBoxNorthEast.x},southWest:{lat:s.boundingBoxSouthWest.y,lng:s.boundingBoxSouthWest.x}},delete s.boundingBoxNorthEast,delete s.boundingBoxSouthWest),[2,s]}})})},e.prototype.redo=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e+"/update",this.client.serviceKey,!1),[4,r(this.client).fetch(i,"PATCH")];case 1:return s=n.sent(),[2,s]}})})},e}(),z=function(){function e(t){this.client=t}return e.prototype.create=function(e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return e.length?(i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/start",this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),o=new U(this.client.serviceUrl,this.client.serviceKey,e,s),[4,r(this.client).fetch(i,"POST",o)]):[2,null];case 1:return a=n.sent(),[2,a&&+a.id]}})})},e.prototype.ready=function(e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){return e instanceof Array||(e=[e]),i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/ready",this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl)+e.map(function(t){return"&simulationId="+encodeURIComponent(""+ +t)}),[2,r(this.client).fetch(i)]})})},e.prototype.fetch=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/"+e,this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),s=G.bind,[4,r(this.client).fetch(i)];case 1:return[2,new(s.apply(G,[void 0,n.sent()]))]}})})},e}(),K=function(){function t(t,e,i,n){this.id=t,this.lng=e,this.lat=i,this.properties=n,this.properties&&(this.properties["marker-size"]=1)}return t.prototype.toString=function(){return this.properties?this.properties.name:""},t.prototype.copy=function(){var e=new t(this.id,this.lat,this.lng,p({},this.properties));for(var i in this)"properties"!=i&&(e[i]=this[i]);return e},t}(),Y=function(){function t(t){this.client=t}return t.prototype.queryRaw=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(this.client.config.overpassUrl+"/api/interpreter","POST-RAW",t)];case 1:return e=i.sent(),[2,e.elements.filter(function(t){return!!t.tags}).map(function(t){return h(t)})]}})})},t.prototype.query=function(t,e){function i(t){if("*"===t.tag||null==t.tag)return'"'+t.type+'"';if(t.type&&t.tag)return'"'+t.type+'"="'+t.tag+'"';throw new Error("invalid query"+JSON.stringify(t))}var n=[];t.forEach(function(t){e.forEach(function(e){n.push("\n way["+i(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n node["+i(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n ")})});var r="\n [out:json];\n (\n "+n.join("")+"\n );\n out center;\n ";return this.queryRaw(r)},t.prototype.queryGetCustom=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(t)];case 1:return e=i.sent(),[2,e.elements.map(function(t){return h(t)})]}})})},t.prototype.reachable=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return i=this.client.config.poiUrl+"/reachability",[4,r(this.client).fetch(i,"POST",new j(this.client,t,e))];case 1:return[2,n.sent()]}})})},t}(),J=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"polygon",this.client.serviceKey),o=new k(this.client,e,s),[4,r(this.client).fetchCachedData(s.useClientCache,i,"POST",o)];case 1:if(a=n.sent(),"geojson"==s.serializer)return a.metadata=s,[2,a];throw new Error("TODO: svg parsing")}})})},e}(),V=function(){function e(t){this.client=t}return e.prototype.individual=function(e,s,o){return i(this,void 0,void 0,function(){var i,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"time",this.client.serviceKey),a=new L(this.client,e,s,o),[4,r(this.client).fetchCachedData(o.useClientCache,i,"POST",a)];case 1:return[2,n.sent()]}})})},e.prototype.combined=function(e,s,o){return i(this,void 0,void 0,function(){var i,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"reachability",this.client.serviceKey),a=new L(this.client,e,s,o),[4,r(this.client).fetchCachedData(o.useClientCache,i,"POST",a)];case 1:return[2,n.sent()]}})})},e.prototype.count=function(t,e,r){return i(this,void 0,void 0,function(){return n(this,function(i){switch(i.label){case 0:return[4,this.locations(t,e,r)];case 1:return[2,i.sent().length]}})})},e.prototype.locations=function(t,e,r){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i={},e.forEach(function(t){return i[String(t.id)]=-1}),[4,this.combined(t,e,r)];case 1:return(s=n.sent()).forEach(function(t){var e=String(t.id);i[e]?t.travelTime>-1&&(i[e]>-1?i[e]=Math.min(i[e],t.travelTime):i[e]=t.travelTime):console.warn("NOT FOUND",String(t.id))}),[2,e.filter(function(t){var e=String(t.id);return t.travelTime=i[e],i[e]>-1})]}})})},e}(),Z=function(t){function i(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return r.recommendations&&s.sources&&s.sources.forEach(function(t){if(null!=t.tm)for(var e in t.tm)t.tm[e].recommendations=1}),s}return e(i,t),i}(L),X=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,s,o){return i(this,void 0,void 0,function(){var i,a,u,c=this;return n(this,function(n){switch(n.label){case 0:return i=new Z(this.client,e,s,o),a=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"route",this.client.serviceKey)+"&cfg="+encodeURIComponent(JSON.stringify(i)),console.log(a),[4,r(this.client).fetchCachedData(o.useClientCache,a,"JSONP")];case 1:return u=n.sent(),[2,u.routes.map(function(t){return new P(c.client,t.travelTime,t.segments,t)})]}})})},e}(),$=function(){function t(t){this.client=t}return t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return e=this.client.config.tilesUrl+"/similarity/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,i.sent()]}})})},t.prototype.fetch=function(t,e,s,o,a){return i(this,void 0,void 0,function(){var i,u,c,l;return n(this,function(n){switch(n.label){case 0:return i={west:o.southWest.lng,south:o.southWest.lat,east:o.northEast.lng,north:o.northEast.lat},u={bounds:i,refCellId:e,scores:s.map(function(t){return{source:t.source,minutes:t.minutes,factor:t.factor||1}})},c=a?"?normalizeOnViewport="+!!a:"",l=this.client.config.tilesUrl+"/similarity/scores_cumulative/v1/"+encodeURIComponent(""+t)+c,[4,r(this.client).fetch(l,"POST",u)];case 1:return[2,n.sent()]}})})},t}(),Q=function(){return function(t,e,i){this.useCache=void 0==i.useCache||i.useCache;var n=i.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id});this.statisticGroupId=+i.statisticsGroup,this.statisticIds=n,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,this.intersectionGeometry={data:e,crs:i.crs||4326}}}(),tt=function(){function t(t){this.client=t,this.statisticsMetadataCache=new v(200)}return t.prototype.combined=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.dependent(t,e)];case 1:return i=n.sent(),[2,i&&i.statistics]}})})},t.prototype.individual=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.dependent(t,e)];case 1:return i=n.sent(),[2,i&&i.individualStatistics]}})})},t.prototype.travelTimes=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return t.length?(i=this.client.config.statisticsUrl+"/traveltimes?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new E(this.client,t,e))]):[2,null];case 1:return[2,n.sent()]}})})},t.prototype.dependent=function(t,e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return t.length?(i=this.client.config.statisticsUrl+"/charts/dependent?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new E(this.client,t,e))]):[2,null];case 1:return s=n.sent(),[2,new N(s,e.statistics)]}})})},t.prototype.geometry=function(t,e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return t?(i=this.client.config.statisticsUrl+"/values/geometry?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new Q(this.client,t,e))]):[2,null];case 1:return s=n.sent(),[2,new W(s,e.statistics)]}})})},t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e,s,o,a=this;return n(this,function(u){switch(u.label){case 0:return e=this.client.config.tilesUrl,s="number"==typeof t?t:t.id,o=e+"-"+s,[4,this.statisticsMetadataCache.get(o,function(){return i(a,void 0,void 0,function(){var t;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(e+"/statistics/meta/v1/"+s)];case 1:return!(t=i.sent()).name&&t.names&&t.names.en&&(t.name=t.names.en),t.stats&&t.stats.length&&t.stats.forEach(function(t){!t.name&&t.names&&t.names.en&&(t.name=t.names.en)}),[2,t]}})})})];case 1:return[2,u.sent()]}})})},t.prototype.metadataKey=function(t,e){return i(this,void 0,void 0,function(){var i,r,s,o;return n(this,function(n){switch(n.label){case 0:return[4,this.metadata(t)];case 1:for(i=n.sent(),r=0,s=i.stats;r<s.length;r++)if(o=s[r],e.id==o.statistic_id||o.names&&o.names.en==e.name)return[2,o];return[2,null]}})})},t.prototype.tileRoute=function(t,e){return this.client.config.tilesUrl+"/statistics/tiles/v1/"+("number"==typeof t?t:t.id)+"/{z}/{x}/{y}.mvt?columns="+encodeURIComponent(e.map(function(t){return+t.id}).join(","))+"&key="+encodeURIComponent(this.client.serviceKey)},t}(),et=function(){return function(t,e){this.esri=t,this.photon=e}}(),it=function(){function t(t,e,i){if(this.serviceKey=e,!t)throw new TypeError("Region parameter is missing");this.config=new f(i),t.includes("http")||t.includes("localhost")||t.includes("/")?this.serviceUrl=t:this.serviceUrl="https://api.targomo.com/"+t+"/",this.pois=new Y(this),this.statistics=new tt(this),this.reachability=new V(this),this.optimizations=new z(this),this.geocoding=new et(new T,new w(this)),this.polygons=new J(this),this.routes=new X(this),this.similarity=new $(this),this.benchmarks=new S(this),this.multigraph=new q(this)}return Object.defineProperty(t.prototype,"endpoint",{get:function(){var t=this.serviceUrl.split("/").filter(function(t){return!!t});return t[t.length-1]},enumerable:!0,configurable:!0}),t.prototype.metadata=function(){return i(this,void 0,void 0,function(){var t,e,i;return n(this,function(n){switch(n.label){case 0:return t=this.endpoint,e=this.serviceKey,i=this.config.serverUrl+"/"+t+"/v1/metadata/network?key="+encodeURIComponent(e),[4,r().fetch(i)];case 1:return[2,n.sent()]}})})},t}(),nt=M;t.geometry=nt,t.PointsOfInterestClient=Y,t.ClientConfig=f,t.BenchmarksClient=S,t.GeocodeEsriClient=T,t.GeocodePhotonClient=w,t.MultigraphClient=q,t.OptimizationsClient=z,t.PolygonsClient=J,t.ReachabilityClient=V,t.RoutesClient=X,t.SimilarityClient=$,t.StatisticsClient=tt,t.GeocodingClients=et,t.TargomoClient=it,t.LatLng=C,t.BoundingBox=A,t.TravelSpeedValues=I,t.StatisticValues=R,t.Route=P,t.RouteSegment=O,t.StatisticsResult=N,t.OptimizationResult=G,t.StatisticsGeometryResult=W,t.RequestsUtil=b,t.requests=r,t.SimpleLRU=v,t.SimpleCache=g,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.tgm={})}(this,function(t){"use strict";function e(t,e){function i(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function i(t,e,i,n){return new(i||(i=Promise))(function(r,s){function o(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(o,a)}c((n=n.apply(t,e||[])).next())})}function n(t,e){function i(i){return function(o){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[0,s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(s=a.trys,!(s=s.length>0&&s[s.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,o])}}var n,r,s,o,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o}function r(t,e){return new b}function s(t,e){var i=D*t.lat,n=D*t.lng,r=D*e.lat,s=D*e.lng;return Math.acos(Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos(n-s))*x}function o(t,e){e*=1e3;var i=t.lat,n=t.lng,r=i*D,s=e/1e3/110.574235,o=e/1e3/(110.572833*Math.cos(r));return{northEast:{lat:i+s,lng:n+o},southWest:{lat:i-s,lng:n-o}}}function a(t){switch(t.travelType){case"walk":return 10;case"bike":return 25;case"transit":return 150;default:return 120}}function c(t,e,i){return e instanceof Array?u(t,e,i).filter(function(t){return!e.some(function(e){return e==t})}):u(t,e,i).filter(function(t){return e!=t})}function u(t,e,i){return e instanceof Array?t.filter(function(t){return e.some(function(e){return s(t,e)<=i})}):t.filter(function(t){return s(t,e)<=i})}function l(t,e){var i=R.unproject(t);return void 0!=e?{lat:i.lat,lng:i.lng,elevation:e}:i}function h(t){var e=t.lat,i=t.lon;return void 0===e&&t.center&&(e=t.center.lat,i=t.center.lon),new q(t.id,i,e,t.tags)}!function(t){function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function i(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return d.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function s(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function o(t){return new Promise(function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}})}function a(t){var e=new FileReader,i=o(e);return e.readAsArrayBuffer(t),i}function c(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(d.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(d.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(d.arrayBuffer&&d.blob&&m(t))this._bodyArrayBuffer=c(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!d.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!v(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=c(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d.blob&&(this.blob=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(a)}),this.text=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=o(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n<e.length;n++)i[n]=String.fromCharCode(e[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t,e){var i=(e=e||{}).body;if(t instanceof l){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=function(t){var e=t.toUpperCase();return g.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(r))}}),e}function f(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var d={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(d.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},v=ArrayBuffer.isView||function(t){return t&&p.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,n){t=e(t),n=i(n);var r=this.map[t];this.map[t]=r?r+","+n:n},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,n){this.map[e(t)]=i(n)},r.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,i){t.push(i)}),n(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,i){t.push([i,e])}),n(t)},d.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this,{body:this._bodyInit})},u.call(l.prototype),u.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},f.error=function(){var t=new f(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];f.redirect=function(t,e){if(-1===y.indexOf(e))throw new RangeError("Invalid status code");return new f(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=l,t.Response=f,t.fetch=function(t,e){return new Promise(function(i,n){var s=new l(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:function(t){var e=new r;return t.split(/\r?\n/).forEach(function(t){var i=t.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();e.append(n,r)}}),e}(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;i(new f(e,t))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.open(s.method,s.url,!0),"include"===s.credentials&&(o.withCredentials=!0),"responseType"in o&&d.blob&&(o.responseType="blob"),s.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===s._bodyInit?null:s._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:window);var f=function(){return function(t){this.serverUrl="https://api.targomo.com",this.statisticsUrl="https://api.targomo.com/statistics",this.tilesUrl="https://api.targomo.com/vector-statistics",this.poiUrl="https://api.targomo.com/pointofinterest",this.mapTilesUrl="https://maps.targomo.com",this.photonGeocoderUrl="https://api.targomo.com/geocode",this.overpassUrl="https://api.targomo.com/overpass",this.fleetsUrl="https://api.targomo.com/fleetplanner",Object.assign(this,t)}}(),d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},p=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},m=function(){return function(t,e,i,n){this.value=t,this.key=e,this.previous=i,this.next=n}}(),v=function(){function t(t){void 0===t&&(t=0),this.capacity=t,this.map={},this.size=0}return t.prototype.get=function(t,e){return i(this,void 0,void 0,function(){var i,r,s,o,a,c;return n(this,function(n){switch(n.label){case 0:if(void 0===(i=this.map[t]))return[3,5];this.oldest==i&&i.next&&(this.oldest=i.next),i.next&&(i.next.previous=i.previous),i.previous&&(i.previous.next=i.next),i.previous=this.newest,i.next=null,this.newest=i,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i.value];case 2:return[2,n.sent()];case 3:return r=n.sent(),this.map[t]=void 0,[2,this.get(t,e)];case 4:return[3,8];case 5:return e?(s=e(),o=this.map[t]=new m(s,t,this.newest,null),[4,s]):[3,7];case 6:return a=n.sent(),this.newest&&(this.newest.next=o),this.newest=o,this.capacity&&(this.size>=this.capacity?(c=this.oldest)&&(this.oldest=c.next,delete this.map[c.key]):this.size++),this.oldest||(this.oldest=this.newest),[2,a];case 7:return[2,void 0];case 8:return[2]}})})},t}(),g=function(){function t(){this.map={}}return t.prototype.get=function(t,e){return i(this,void 0,void 0,function(){var i,r;return n(this,function(n){switch(n.label){case 0:return i="string"==typeof t?t:JSON.stringify(t),void 0==this.map[i]?[3,1]:[2,this.map[i]];case 1:return[4,e()];case 2:return r=n.sent(),this.map[i]=r,[2,r]}})})},t}(),y=new g,b=function(){function t(){}return t.prototype.fetch=function(t,e,r,s){return void 0===e&&(e="GET"),void 0===s&&(s={}),i(this,void 0,void 0,function(){var i,o,a,c,u,l,h,f,d,p;return n(this,function(n){switch(n.label){case 0:return i=e,"JSONP"!==e?s.Accept=s.Accept?s.Accept:"application/json":i="GET","POST-RAW"===e&&(i="POST"),"PUT"!==i&&"POST"!==i||(s["Content-Type"]="application/json"),o={method:i,headers:new Headers(s)},"POST-RAW"===e?o.body=r:"GET"!==e&&"JSONP"!==e&&(o.body=JSON.stringify(r)),[4,fetch(t,o)];case 1:return(a=n.sent()).status>=400?"application/json"!==a.headers.get("content-type")?[3,3]:(h=(l=JSON).stringify,[4,a.text()]):[3,6];case 2:return u=h.apply(l,[n.sent(),null,2]),[3,5];case 3:return[4,a.text()];case 4:u=n.sent(),n.label=5;case 5:throw c=u,console.error("[ERROR] in service request\n status = "+a.status+" "+a.statusText+"\n url = "+t+"\n body = "+c),new Error(c);case 6:return"JSONP"!==e?[3,8]:[4,a.text()];case 7:return f=n.sent(),d=f.indexOf("("),p=f.lastIndexOf(")"),d>-1&&p>-1?[2,JSON.parse(f.substring(d+1,p))]:[2,JSON.parse(f)];case 8:return[2,a.json()];case 9:return[2]}})})},t.prototype.fetchData=function(t,e,r,s){return void 0===e&&(e="GET"),i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.fetch(t,e,r,s)];case 1:return(i=n.sent()).data?[2,i.data]:(console.warn("No data object was transmitted by "+t+" \nReturning raw response"),[2,i])}})})},t.prototype.fetchCached=function(t,e,i,n,r){var s=this;if(void 0===i&&(i="GET"),!1!==t){!0!==t&&t||(t=y);var o=JSON.stringify({url:e,method:i,payload:n});return t.get(o,function(){return s.fetch(e,i,n,r)})}return this.fetch(e,i,n,r)},t.prototype.fetchCachedData=function(t,e,i,n,r){var s=this;if(void 0===i&&(i="GET"),!1!==t){!0!==t&&t||(t=y);var o=JSON.stringify({url:e,method:i,payload:n});return t.get(o,function(){return s.fetchData(e,i,n,r)})}return this.fetchData(e,i,n,r)},t}(),T=function(){function t(t){this.client=t}return t.prototype.fetch=function(t,e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return i={west:s.southWest.lng,south:s.southWest.lat,east:s.northEast.lng,north:s.northEast.lat},o={bounds:i,benchmarks:e.map(function(t){return{source:t.source,minEnd:t.minEnd,minStart:t.minStart,factor:t.factor}})},a=this.client.config.tilesUrl+"/benchmarks/scores_cumulative/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(a,"POST",o)];case 1:return[2,n.sent()]}})})},t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return e=this.client.config.tilesUrl+"/benchmarks/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,i.sent()]}})})},t}();!function(t){t.queryToString=function(t){var e=[];for(var i in t){var n=t[i];void 0!==n&&e.push(i+"="+encodeURIComponent(n))}return e.join("&")},t.buildTargomoUrl=function(t,e,i,n){return void 0===n&&(n=!0),"/"!==t[t.length-1]&&(t+="/"),t+(n?"v1/":"")+e+"?key="+i}}(t.UrlUtil||(t.UrlUtil={}));var S=function(){function e(){}return e.prototype.geocode=function(e,s,o,a,c){return i(this,void 0,void 0,function(){var i,o,u,l;return n(this,function(n){switch(n.label){case 0:return i={singleLine:e,f:"json",countryCode:a,maxLocations:5},s&&(i.location=s.lng+","+s.lat),c&&(i.magicKey=c),o="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?"+t.UrlUtil.queryToString(i),[4,r().fetch(o)];case 1:return u=n.sent(),l=u.candidates.map(function(t){return{lat:t.location.y,lng:t.location.x,description:t.address}}),[2,l]}})})},e.prototype.suggest=function(e,s,o,a,c){return void 0===c&&(c=5),i(this,void 0,void 0,function(){var i,o;return n(this,function(n){switch(n.label){case 0:return i={text:e,f:"json",countryCode:a,maxSuggestions:c},s&&(i.location=s.lng+","+s.lat),[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?"+t.UrlUtil.queryToString(i))];case 1:return o=n.sent(),[2,o.suggestions]}})})},e.prototype.reverseGeocode=function(e,s){return i(this,void 0,void 0,function(){var i,s,o;return n(this,function(n){switch(n.label){case 0:return i={f:"json"},i.location=e.lng+","+e.lat,[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?"+t.UrlUtil.queryToString(i))];case 1:return(s=n.sent())&&s.address?(o={address:s.address.Match_addr,city:s.address.City,countryCode:s.address.CountryCode,location:s.address.Loc_name,region:s.address.Region,subregion:s.address.Subregion,zip:s.address.Postal},[2,o]):[2,{}]}})})},e}(),w=function(){function t(t){this.client=t}return t.prototype.geocode=function(t,e,s){return i(this,void 0,void 0,function(){var i,o,a,c,u=this;return n(this,function(n){switch(n.label){case 0:return i=this.client.config.photonGeocoderUrl,o=i+"/api/?q="+encodeURIComponent(t)+"&limit=5",e&&(o+="&lat="+e.lat+"&lon="+e.lng),s&&(o+="&lang="+encodeURIComponent(s)),[4,r().fetch(o)];case 1:return(a=n.sent()).features.forEach(function(t,e,i){"boundary"==t.properties.osm_key&&i.splice(e,1)}),c=a.features.map(function(t){return t.value=t.properties.osm_id,t.description=u.buildPlaceDescription(t.properties),t}),[2,c]}})})},t.prototype.buildPlaceDescription=function(t){var e=function(t,e){return void 0===e&&(e=" "),t.filter(function(t){return!!t}).join(e).trim()},i=function(i,n){return e(i.map(function(e){return t[e]}),n)},n=i(["street","housenumber"]," "),r=e([i(["postcode","city"]," "),t.country],", "),s={title:"",meta1:"",meta2:"",full:""};return void 0!==t.name?(s.title=t.name,s.meta1=n,s.meta2=r):(s.title=n,s.meta1=r),t.name!==n&&(s.full=s.title),s.meta1&&t.name!==n&&(s.full+=", "+s.meta1),s.meta1&&t.name===n&&(s.full+=s.meta1),s.full=e([s.full,s.meta2],", "),s},t}(),U=function(){return function(t,e,i,n){var r=this;if(this.sources={},this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.time=this.transitFrameDate,this.date=this.transitFrameTime,this.travelType=n.travelType,this.maxEdgeWeight=n.maxEdgeWeight,this.edgeWeight=n.edgeWeight,this.date=this.transitFrameDate=n.transitFrameDate,this.time=this.transitFrameTime=n.transitFrameTime,this.transitFrameDuration=n.transitFrameDuration,null!=n.transitFrameDateTime){var s=new Date(n.transitFrameDateTime),o=s?1e4*s.getFullYear()+100*(s.getMonth()+1)+s.getDate():void 0,a=s?3600*s.getHours()+60*s.getMinutes():void 0;this.date=this.transitFrameDate=o||this.transitFrameDate,this.time=this.transitFrameTime=a||this.transitFrameTime}this.description=n.description||"",this.maxEdgeWeight=n.maxEdgeWeight,this.serviceUrl=t,this.serviceKey=e,this.email=n.email||"developers@targomo.com",this.sendMail=!1,this.callbackUrl=n.callbackUrl||"https://localhost/",this.useCache=n.useCache,this.pointsPerSolution=n.pointsPerSolution,this.maxSolutions=n.maxSolutions||1,this.statisticGroupId=n.statisticGroup,n.statistic instanceof Number||"number"==typeof n.statistic?this.statisticId=+n.statistic:this.statisticId=n.statistic.id,i.forEach(function(t){r.sources[t.id]={id:t.id,x:t.lng,y:t.lat}})}}(),E=function(){return function(t,e,i){if(this.inactiveSources=[],this.sources=[],this.getClosestSources=!1,this.intersectionMode="union",this.appendTravelTimes=!1,this.date=i.transitFrameDate||20170801,this.time=i.transitFrameTime||39600,null!=i.transitFrameDateTime){var n=new Date(i.transitFrameDateTime),r=n?1e4*n.getFullYear()+100*(n.getMonth()+1)+n.getDate():void 0,s=n?3600*n.getHours()+60*n.getMinutes():void 0;this.date=this.date=r||this.date,this.time=this.time=s||this.time}this.edgeWeight=void 0==i.edgeWeight?"time":i.edgeWeight,this.useCache=void 0==i.useCache||i.useCache,this.travelType=i.travelType,this.intersectionMode=i.intersectionMode||"union",this.sources=e.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}),i.inactiveSources&&(this.inactiveSources=i.inactiveSources.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}));var o=[];i.statistics&&(this.omitIndividualStatistics=i.omitIndividualStatistics,o=i.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id})),this.statisticGroupId=+i.statisticsGroup,this.statisticIds=o,this.maxEdgeWeight=i.maxEdgeWeight,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,i.closestSources&&(this.getClosestSources=!0),i.walkSpeed&&(this.walkDownhill=i.walkSpeed.downhill,this.walkSpeed=i.walkSpeed.speed,this.walkUphill=i.walkSpeed.uphill),i.bikeSpeed&&(this.bikeDownhill=i.bikeSpeed.downhill,this.bikeSpeed=i.bikeSpeed.speed,this.bikeUphill=i.bikeSpeed.uphill)}}(),C=function(){return function(){}}(),A=function(){return function(){}}();!function(t){t[t.GERMANY_ZENSUS_100M_STATISTICS=9]="GERMANY_ZENSUS_100M_STATISTICS",t[t.GERMANY_ZENSUS_200M_STATISTICS=2]="GERMANY_ZENSUS_200M_STATISTICS",t[t.GERMANY_ZENSUS_500M_STATISTICS=11]="GERMANY_ZENSUS_500M_STATISTICS",t[t.GERMANY_ZENSUS_1000M_STATISTICS=3]="GERMANY_ZENSUS_1000M_STATISTICS",t[t.GERMANY_ZENSUS_2000M_STATISTICS=10]="GERMANY_ZENSUS_2000M_STATISTICS",t[t.NORWAY_STATISTICS=4]="NORWAY_STATISTICS",t[t.CENSUS_BRANDENBURG_POPULATION=12]="CENSUS_BRANDENBURG_POPULATION",t[t.CANADA_BLOCK_STATISTICS=8]="CANADA_BLOCK_STATISTICS",t[t.CANADA_AREA_STATISTICS=5]="CANADA_AREA_STATISTICS",t[t.BERLIN_STATISTICS=6]="BERLIN_STATISTICS"}(t.StatisticsGroups||(t.StatisticsGroups={}));var _=function(){return function(){}}(),I=function(){return function(t){this.values=t,this.total=0;for(var e in this.values)this.total+=this.values[e]}}();!function(t){t[t.SRID_3857=3857]="SRID_3857",t[t.SRID_4326=4326]="SRID_4326"}(t.SRID||(t.SRID={})),function(t){t.NONE="none",t.SUM="sum",t.MAX="max",t.MIN="min",t.MEAN="mean",t.MEDIAN="median",t.NEAREST="nearest"}(t.MultigraphRequestAggregation||(t.MultigraphRequestAggregation={}));var R=new(function(){function t(){this.R=6378137}return t.prototype.project=function(t){var e=Math.PI/180,i=Math.max(Math.min(Math.sin(t.lat*e),1-1e-15),-(1-1e-15));return{x:this.R*t.lng*e,y:this.R*Math.log((1+i)/(1-i))/2}},t.prototype.unproject=function(t){var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,lng:t.x*e/this.R}},t}()),x=6371.01,D=Math.PI/180,M=Object.freeze({contains:function(t,e){return e.lat>=t.southWest.lat&&e.lat<=t.northEast.lat&&e.lng>=t.southWest.lng&&e.lng<=t.northEast.lng},calculateDistance:s,boundingBox:o,locationsWithinTravelOptions:function(t,e,i){var n,r=i.maxEdgeWeight;switch(i.travelType){case"walk":n=10;break;case"bike":n=25;break;case"transit":n=150;break;default:n=120}return c(t,e,"distance"===i.edgeWeight?Math.round(r/1e3):n*r/3600)},boundingBoxWithinTravelOptions:function(t,e){var i=e.maxEdgeWeight,n=a(e);return o(t,"distance"===e.edgeWeight?Math.round(i/1e3):n*i/3600)},boundingBoxFromLocationArray:function(t){return t.reduce(function(t,e){return t.northEast.lat=e.lat>t.northEast.lat?e.lat:t.northEast.lat,t.northEast.lng=e.lng>t.northEast.lng?e.lng:t.northEast.lng,t.southWest.lat=e.lat<t.southWest.lat?e.lat:t.southWest.lat,t.southWest.lng=e.lng<t.southWest.lng?e.lng:t.southWest.lng,t},{northEast:{lat:t[0].lat,lng:t[0].lng},southWest:{lat:t[0].lat,lng:t[0].lng}})},boundingBoxListWithinTravelOptions:function(t,e){var i=e.maxEdgeWeight,n=a(e),r="distance"===e.edgeWeight?Math.round(i/1e3):n*i/3600,s={northEast:{lat:-1/0,lng:-1/0},southWest:{lat:1/0,lng:1/0}};return t.forEach(function(t){var e=o(t,r);s.northEast.lat=Math.max(s.northEast.lat,e.northEast.lat),s.northEast.lng=Math.max(s.northEast.lng,e.northEast.lng),s.southWest.lat=Math.min(s.southWest.lat,e.southWest.lat),s.southWest.lng=Math.min(s.southWest.lng,e.southWest.lng)}),s},locationsWithinDistance:c,locationsWithinDistanceInclusive:u,webMercatorToLatLng:l,latLngToWebMercator:function(t){return R.project(t)}}),O=function(){return function(t,e){var i=this;this.points=[],this.type=e.type,this.travelTime=e.travelTime,this.distance=e.length/1e3,this.warning=e.warning,this.elevationGain=e.elevationGain,this.transitSegment=!1,this.startName=e.startname,this.endName=e.endname,e.points.forEach(function(t){i.points.push(l({x:t[1],y:t[0]},t[2]))}),e.isTransit&&(this.transitSegment=!0,this.routeType=e.routeType,this.routeShortName=e.routeShortName,this.startName=e.startname,this.endName=e.endname,this.departureTime=e.departureTime,this.arrivalTime=e.arrivalTime,this.tripHeadSign=e.tripHeadSign)}}(),k=function(){function t(t,e,i,n){var r=this;this.travelTime=e,this.routeSegments=[],this.targetHeight=void 0,this.sourceHeight=void 0,this.sourceId=void 0,this.targetId=void 0,this.length=void 0;var s=0,o=[];i.reverse().forEach(function(e){var i=new O(t,e);r.routeSegments.push(i),"TRANSFER"===i.type&&s++,o=o.concat(i.points.reverse())}),this.points=o,this.transfers=s,void 0!==n&&(this.sourceId=n.source_id,this.targetId=n.target_id,this.length=n.length);var a=this.calculateElevationDifferences(this.points);this.targetHeight=a.targetHeight,this.sourceHeight=a.sourceHeight,this.uphillMeter=a.uphillMeter,this.downhillMeter=a.downhillMeter,this.totalElevationDifference=Math.abs(this.sourceHeight-this.targetHeight),this.departureTime=this.calculateDepartureTime(),this.arrivalTime=this.calculateArrivalTime(),this.distance=this.calculateDistance(),this.elevationGain=this.calculateElevationGain()}return t.prototype.calculateDistance=function(){for(var t=0,e=0;e<this.routeSegments.length;e++)t+=this.routeSegments[e].distance;return t},t.prototype.calculateElevationGain=function(){for(var t=void 0,e=0;e<this.routeSegments.length;e++)isFinite(this.routeSegments[e].elevationGain)&&(t=(t||0)+this.routeSegments[e].elevationGain);return t},t.prototype.calculateElevationDifferences=function(t){for(var e=void 0,i=void 0,n=void 0,r=0,s=0,o=this.points.length-1;o>=0;o--)0==o&&(i=this.points[o].elevation),o==this.points.length-1&&(n=this.points[o].elevation),void 0!==e&&(e>this.points[o].elevation?r+=e-this.points[o].elevation:e<this.points[o].elevation&&(s+=this.points[o].elevation-e)),e=this.points[o].elevation;return{targetHeight:i,sourceHeight:n,uphillMeter:r,downhillMeter:s}},t.prototype.calculateDepartureTime=function(){for(var t=0,e=0;e<this.routeSegments.length;e++){var i=this.routeSegments[e];if(null!=i.departureTime)return i.departureTime-t;t+=i.travelTime||0}},t.prototype.calculateArrivalTime=function(){for(var t=0,e=this.routeSegments.length-1;e>=0;e--){var i=this.routeSegments[e];if(null!=i.arrivalTime)return i.arrivalTime-t;t+=i.travelTime||0}},t}(),F=function(){return function(t,e){function i(t){for(var i={},n=0,r=e;n<r.length;n++){var s=r[n];i[s.name]=new I(t[s.id])}return i}var n={};if(t.individualStatistics)for(var r in t.individualStatistics)t.individualStatistics[r]&&t.individualStatistics[r].statistics&&(n[r]=i(t.individualStatistics[r].statistics));this.statistics=i(t.statistics),this.individualStatistics=n,this.raw=t}}();!function(t){t.CREATED="CREATED",t.ROUTING="ROUTING",t.MERGING="MERGING",t.AGGREGATING="AGGREGATING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"}(t.MultigraphStatus||(t.MultigraphStatus={}));var N=function(){return function(t){this.raw=t,this.id=t.id,this.maxPossibleValue=t.maxPossibleValue,this.solutions=t.simulationResults.map(function(t){var e={};return t.sourcePoints.forEach(function(t){e[t.id]=t.optimal}),{id:t.id,startTime:t.startTime,endTime:t.endTime,maxValue:t.maxValue,numberOfDesiredPoints:t.numberOfDesiredPoints,sources:e}})}}(),P=function(){return function(t,e){this.values={};var i={};e.forEach(function(t){i[t.id]=t.name}),this.raw=t;var n=this.values;for(var r in t){var s=t[r],o=(s.aggregation||"").toLowerCase();n[o]=n[o]||{};var a=i[s.statisticId];n[o][a]={value:s.value}}}}(),G=function(){function t(t){if(this.closestSources=!1,this.requestTimeout=null,this.walkSpeed={},this.bikeSpeed={},this.sources=[],this.targets=[],this.rushHour=!1,this.reverse=!1,this.recommendations=!1,this.pathSerializer="compact",this.polygonSerializer="json",this.pointReduction=!0,this.maxEdgeWeight=1800,this.travelType="bike",this.travelSpeed="medium",this.edgeWeight="time",this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.date=this.transitFrameDate,this.time=this.transitFrameTime,this.elevation=!0,this.useCache=!0,this.travelEdgeWeights=null,Object.assign(this,t),null!=t.transitFrameDateTime){var e=new Date(t.transitFrameDateTime),i=e?1e4*e.getFullYear()+100*(e.getMonth()+1)+e.getDate():void 0,n=e?3600*e.getHours()+60*e.getMinutes():void 0;this.date=this.transitFrameDate=i||this.transitFrameDate,this.time=this.transitFrameTime=n||this.transitFrameTime}}return t.prototype.buildTargetsCfg=function(t){return t.map(function(t){return{lat:t.lat,lng:t.lng,id:t.id}})},t.prototype.buildSourcesCfg=function(t){var e=this;return t.map(function(t){var i={lat:t.lat,lng:t.lng,id:t.id,tm:t.tm};if(!i.tm)switch(e.travelType){case"car":i.tm={car:e.rushHour?{rushHour:e.rushHour}:{}};break;case"walk":i.tm={walk:e.walkSpeed};break;case"bike":i.tm={bike:e.bikeSpeed};break;case"transit":i.tm={transit:{frame:{date:e.transitFrameDate,time:e.transitFrameTime},duration:e.transitFrameDuration}}}return i})},t}(),W=function(){return function(){this.minPolygonHoleSize=1e7,this.buffer=50,this.simplify=50,this.srid=t.SRID.SRID_4326,this.quadrantSegments=2,this.intersectionMode="union",this.decimalPrecision=6}}(),B=function(t){function i(e,i,n){var r=t.call(this,n)||this;return r.polygon=new W,r.sources=r.buildSourcesCfg(i),r.polygon.values=n.travelEdgeWeights,r.polygon.serializer=n.serializer,r.polygon.simplify=n.simplifyMeters,r.polygon.srid=n.srid,r.polygon.buffer=n.buffer,r.polygon.minPolygonHoleSize=n.minPolygonHoleSize,r.polygon.quadrantSegments=n.quadrantSegments,r.polygon.intersectionMode=n.intersectionMode,r}return e(i,t),i}(G),j=function(t){function i(e,i,n){var r=t.call(this,n)||this;return r.osmTypes=[],r.sources=r.buildSourcesCfg([i]),r.osmTypes=n.osmTypes,r.serviceKey=e.serviceKey,r.serviceUrl=e.serviceUrl,r}return e(i,t),i}(G),L=function(t){function i(e,i,n,r){var s=t.call(this,r)||this;return s.sources=s.buildSourcesCfg(i),s.targets=s.buildTargetsCfg(n),null!=r.intersectionMode&&(s.polygon={intersectionMode:r.intersectionMode}),s}return e(i,t),i}(G),z=function(t){function i(e,i,n){var r=t.call(this,e,i,n)||this;return delete r.inactiveSources,delete r.statisticGroupId,delete r.statisticIds,delete r.getClosestSources,delete r.useCache,n&&(r.multiGraphSerializationType=n.serialization&&n.serialization.type,r.multiGraphSerializationDecimalPrecision=n.serialization&&n.serialization.decimalPrecision,n.aggregation&&(r.multiGraphAggregationType=n.aggregation.type||null,r.multiGraphAggregationIgnoreOutlier=n.aggregation.ignoreOutliers||null,r.multiGraphAggregationMinSourcesRatio=n.aggregation.minSourcesRatio||null,r.multiGraphAggregationMinSourcesCount=n.aggregation.minSourceCount||null,r.multiGraphAggregationMaxResultValueRatio=n.aggregation.maxResultValueRatio||null,r.multiGraphAggregationMaxResultValue=n.aggregation.maxResultValue||null)),r}return e(i,t),i}(E),H=function(){function e(t){this.client=t}return e.prototype.create=function(e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph",this.client.serviceKey,!1),o=new z(this.client,e,s),[4,r(this.client).fetchCachedData(s.useClientCache,i,"POST",o,{Accept:"text/plain"})];case 1:return a=n.sent(),[2,a]}})})},e.prototype.info=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e,this.client.serviceKey,!1),[4,r(this.client).fetch(i,"GET")];case 1:return(s=n.sent()).boundingBoxNorthEast&&s.boundingBoxSouthWest&&(s.boundingBox={northEast:{lat:s.boundingBoxNorthEast.y,lng:s.boundingBoxNorthEast.x},southWest:{lat:s.boundingBoxSouthWest.y,lng:s.boundingBoxSouthWest.x}},delete s.boundingBoxNorthEast,delete s.boundingBoxSouthWest),[2,s]}})})},e.prototype.redo=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e+"/update",this.client.serviceKey,!1),[4,r(this.client).fetch(i,"PATCH")];case 1:return s=n.sent(),[2,s]}})})},e}(),K=function(){function e(t){this.client=t}return e.prototype.create=function(e,s){return i(this,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return e.length?(i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/start",this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),o=new U(this.client.serviceUrl,this.client.serviceKey,e,s),[4,r(this.client).fetch(i,"POST",o)]):[2,null];case 1:return a=n.sent(),[2,a&&+a.id]}})})},e.prototype.ready=function(e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){return e instanceof Array||(e=[e]),i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/ready",this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl)+e.map(function(t){return"&simulationId="+encodeURIComponent(""+ +t)}),[2,r(this.client).fetch(i)]})})},e.prototype.fetch=function(e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"simulation/"+e,this.client.serviceKey,!1)+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),s=N.bind,[4,r(this.client).fetch(i)];case 1:return[2,new(s.apply(N,[void 0,n.sent()]))]}})})},e}(),q=function(){function t(t,e,i,n){this.id=t,this.lng=e,this.lat=i,this.properties=n,this.properties&&(this.properties["marker-size"]=1)}return t.prototype.toString=function(){return this.properties?this.properties.name:""},t.prototype.copy=function(){var e=new t(this.id,this.lat,this.lng,p({},this.properties));for(var i in this)"properties"!=i&&(e[i]=this[i]);return e},t}(),Y=function(){function t(t){this.client=t}return t.prototype.queryRaw=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(this.client.config.overpassUrl+"/api/interpreter","POST-RAW",t)];case 1:return e=i.sent(),[2,e.elements.filter(function(t){return!!t.tags}).map(function(t){return h(t)})]}})})},t.prototype.query=function(t,e){function i(t){if("*"===t.tag||null==t.tag)return'"'+t.type+'"';if(t.type&&t.tag)return'"'+t.type+'"="'+t.tag+'"';throw new Error("invalid query"+JSON.stringify(t))}var n=[];t.forEach(function(t){e.forEach(function(e){n.push("\n way["+i(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n node["+i(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n ")})});var r="\n [out:json];\n (\n "+n.join("")+"\n );\n out center;\n ";return this.queryRaw(r)},t.prototype.queryGetCustom=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(t)];case 1:return e=i.sent(),[2,e.elements.map(function(t){return h(t)})]}})})},t.prototype.reachable=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return i=this.client.config.poiUrl+"/reachability",[4,r(this.client).fetch(i,"POST",new j(this.client,t,e))];case 1:return[2,n.sent()]}})})},t}(),J=function(){function e(t){this.client=t}return e.prototype.fetch=function(t,e){return i(this,void 0,void 0,function(){var i,r;return n(this,function(n){switch(n.label){case 0:return i=new B(this.client,t,e),[4,this._executeFetch(t,e,i)];case 1:return r=n.sent(),"json"===e.serializer?[2,r]:"geojson"===e.serializer?[2,r]:[2]}})})},e.prototype._executeFetch=function(e,s,o){return i(this,void 0,void 0,function(){var e,i;return n(this,function(n){switch(n.label){case 0:return e=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"polygon",this.client.serviceKey),[4,r(this.client).fetchCachedData(s.useClientCache,e,"POST",o)];case 1:return i=n.sent(),i.metadata=s,[2,i]}})})},e}(),V=function(){function e(t){this.client=t}return e.prototype.individual=function(e,s,o){return i(this,void 0,void 0,function(){var i,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"time",this.client.serviceKey),a=new L(this.client,e,s,o),[4,r(this.client).fetchCachedData(o.useClientCache,i,"POST",a)];case 1:return[2,n.sent()]}})})},e.prototype.combined=function(e,s,o){return i(this,void 0,void 0,function(){var i,a;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"reachability",this.client.serviceKey),a=new L(this.client,e,s,o),[4,r(this.client).fetchCachedData(o.useClientCache,i,"POST",a)];case 1:return[2,n.sent()]}})})},e.prototype.count=function(t,e,r){return i(this,void 0,void 0,function(){return n(this,function(i){switch(i.label){case 0:return[4,this.locations(t,e,r)];case 1:return[2,i.sent().length]}})})},e.prototype.locations=function(t,e,r){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return i={},e.forEach(function(t){return i[String(t.id)]=-1}),[4,this.combined(t,e,r)];case 1:return(s=n.sent()).forEach(function(t){var e=String(t.id);i[e]?t.travelTime>-1&&(i[e]>-1?i[e]=Math.min(i[e],t.travelTime):i[e]=t.travelTime):console.warn("NOT FOUND",String(t.id))}),[2,e.filter(function(t){var e=String(t.id);return t.travelTime=i[e],i[e]>-1})]}})})},e}(),Z=function(t){function i(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return r.recommendations&&s.sources&&s.sources.forEach(function(t){if(null!=t.tm)for(var e in t.tm)t.tm[e].recommendations=1}),s}return e(i,t),i}(L),X=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,s,o){return i(this,void 0,void 0,function(){var i,a,c,u=this;return n(this,function(n){switch(n.label){case 0:return i=new Z(this.client,e,s,o),a=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"route",this.client.serviceKey)+"&cfg="+encodeURIComponent(JSON.stringify(i)),console.log(a),[4,r(this.client).fetchCachedData(o.useClientCache,a,"GET",void 0,{Accept:"application/json,application/javascript,*/*"})];case 1:return(c=n.sent()).routes?[2,c.routes.map(function(t){return new k(u.client,t.travelTime,t.segments,t)})]:[2,null]}})})},e}(),$=function(){function t(t){this.client=t}return t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e;return n(this,function(i){switch(i.label){case 0:return e=this.client.config.tilesUrl+"/similarity/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,i.sent()]}})})},t.prototype.fetch=function(t,e,s,o,a){return i(this,void 0,void 0,function(){var i,c,u,l;return n(this,function(n){switch(n.label){case 0:return i={west:o.southWest.lng,south:o.southWest.lat,east:o.northEast.lng,north:o.northEast.lat},c={bounds:i,refCellId:e,scores:s.map(function(t){return{source:t.source,minutes:t.minutes,factor:t.factor||1}})},u=a?"?normalizeOnViewport="+!!a:"",l=this.client.config.tilesUrl+"/similarity/scores_cumulative/v1/"+encodeURIComponent(""+t)+u,[4,r(this.client).fetch(l,"POST",c)];case 1:return[2,n.sent()]}})})},t}(),Q=function(){return function(t,e,i){this.useCache=void 0==i.useCache||i.useCache;var n=i.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id});this.statisticGroupId=+i.statisticsGroup,this.statisticIds=n,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,this.intersectionGeometry={data:e,crs:i.crs||4326}}}(),tt=function(){function t(t){this.client=t,this.statisticsMetadataCache=new v(200)}return t.prototype.combined=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.dependent(t,e)];case 1:return i=n.sent(),[2,i&&i.statistics]}})})},t.prototype.individual=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return[4,this.dependent(t,e)];case 1:return i=n.sent(),[2,i&&i.individualStatistics]}})})},t.prototype.travelTimes=function(t,e){return i(this,void 0,void 0,function(){var i;return n(this,function(n){switch(n.label){case 0:return t.length?(i=this.client.config.statisticsUrl+"/traveltimes?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new E(this.client,t,e))]):[2,null];case 1:return[2,n.sent()]}})})},t.prototype.dependent=function(t,e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return t.length?(i=this.client.config.statisticsUrl+"/charts/dependent?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new E(this.client,t,e))]):[2,null];case 1:return s=n.sent(),[2,new F(s,e.statistics)]}})})},t.prototype.geometry=function(t,e){return i(this,void 0,void 0,function(){var i,s;return n(this,function(n){switch(n.label){case 0:return t?(i=this.client.config.statisticsUrl+"/values/geometry?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(i,"POST",new Q(this.client,t,e))]):[2,null];case 1:return s=n.sent(),[2,new P(s,e.statistics)]}})})},t.prototype.metadata=function(t){return i(this,void 0,void 0,function(){var e,s,o,a=this;return n(this,function(c){switch(c.label){case 0:return e=this.client.config.tilesUrl,s="number"==typeof t?t:t.id,o=e+"-"+s,[4,this.statisticsMetadataCache.get(o,function(){return i(a,void 0,void 0,function(){var t;return n(this,function(i){switch(i.label){case 0:return[4,r(this.client).fetch(e+"/statistics/meta/v1/"+s)];case 1:return!(t=i.sent()).name&&t.names&&t.names.en&&(t.name=t.names.en),t.stats&&t.stats.length&&t.stats.forEach(function(t){!t.name&&t.names&&t.names.en&&(t.name=t.names.en)}),[2,t]}})})})];case 1:return[2,c.sent()]}})})},t.prototype.metadataKey=function(t,e){return i(this,void 0,void 0,function(){var i,r,s,o;return n(this,function(n){switch(n.label){case 0:return[4,this.metadata(t)];case 1:for(i=n.sent(),r=0,s=i.stats;r<s.length;r++)if(o=s[r],e.id==o.statistic_id||o.names&&o.names.en==e.name)return[2,o];return[2,null]}})})},t.prototype.tileRoute=function(t,e){return this.client.config.tilesUrl+"/statistics/tiles/v1/"+("number"==typeof t?t:t.id)+"/{z}/{x}/{y}.mvt?columns="+encodeURIComponent(e.map(function(t){return+t.id}).join(","))+"&key="+encodeURIComponent(this.client.serviceKey)},t}(),et=function(){function t(t){this.client=t,this.basemapsLookup={Bright:"osm-bright-gl-style",Light:"positron-gl-style","Light No-Labels":"positron-nolabels-gl-style",Dark:"dark-matter-gl-style","Dark No-Labels":"dark-matter-nolabels-gl-style",Gray:"gray-gl-style","Gray No-Labels":"gray-nolabels-gl-style","Light blue":"blueberry-gl-style","Dark blue":"fiord-color-gl-style","Dark blue No-Labels":"fiord-color-nolabels-gl-style",Basic:"klokantech-basic-gl-style",Toner:"toner-gl-style"}}return Object.defineProperty(t.prototype,"basemapNames",{get:function(){return Object.keys(this.basemapsLookup)},enumerable:!0,configurable:!0}),t.prototype.getGLStyleURL=function(t){if(!t||!this.basemapsLookup[t])throw new Error("valid style name required to access Targomo basemap");return"https://maps.targomo.com/styles/"+this.basemapsLookup[t]+".json?key="+this.client.serviceKey},t}(),it=function(){return function(t,e,i,n,r){this.stores=[],this.transports=[],this.orders=[];var s;e.travelTimeFactors&&(s={all:e.travelTimeFactors.all,motorway:e.travelTimeFactors.motorway,motorway_link:e.travelTimeFactors.motorway_link,trunk:e.travelTimeFactors.trunk,trunk_link:e.travelTimeFactors.trunk_link,primary:e.travelTimeFactors.primary,primary_link:e.travelTimeFactors.primary_link,secondary:e.travelTimeFactors.secondary,secondary_link:e.travelTimeFactors.secondary_link,tertiary:e.travelTimeFactors.tertiary,residential:e.travelTimeFactors.residential,tertiary_link:e.travelTimeFactors.tertiary_link,road:e.travelTimeFactors.road,unclassified:e.travelTimeFactors.unclassified,service:e.travelTimeFactors.service,living_street:e.travelTimeFactors.living_street,pedestrian:e.travelTimeFactors.pedestrian,track:e.travelTimeFactors.track,path:e.travelTimeFactors.path,cycleway:e.travelTimeFactors.cycleway,footway:e.travelTimeFactors.footway,steps:e.travelTimeFactors.steps,unknown:e.travelTimeFactors.unknown}),this.optimizationTime=e.optimizationTime,this.optimizationAlgorithm=e.optimizationAlgorithm,this.optimizationMetadata={costForDeadlineExpired:e.costForDeadlineExpired,filterMissedDeadlines:e.filterMissedDeadlines,unimprovedWaitingTime:e.unimprovedWaitingTime,costMatrixSource:e.costMatrixSource,geojsonCreation:e.geojsonCreation,travelOptions:{travelType:e.travelType,serviceKey:t.serviceKey,serviceUrl:t.serviceUrl,travelTimeFactors:s,fallbackServiceUrl:"",edgeWeight:e.edgeWeight,maxEdgeWeight:e.maxEdgeWeight,elevationEnabled:e.elevation,rushHour:e.rushHour}},this.stores=i,this.transports=n,this.orders=r}}(),nt=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,s,o,a){return i(this,void 0,void 0,function(){var i,c,u;return n(this,function(n){switch(n.label){case 0:return i=t.UrlUtil.buildTargomoUrl(this.client.config.fleetsUrl,"api/key-auth/optimizations",this.client.serviceKey,!0),c=new it(this.client,a,e,o,s),[4,r(this.client).fetch(i,"POST",c)];case 1:return u=n.sent(),[2,u]}})})},e}(),rt=function(){return function(t,e){this.esri=t,this.photon=e}}(),st=function(){function t(t,e,i){if(this.serviceKey=e,!t)throw new TypeError("Region parameter is missing");this.config=new f(i),t.includes("http")||t.includes("localhost")||t.includes("/")?this.serviceUrl=t:this.serviceUrl="https://api.targomo.com/"+t+"/",this.pois=new Y(this),this.statistics=new tt(this),this.reachability=new V(this),this.optimizations=new K(this),this.geocoding=new rt(new S,new w(this)),this.polygons=new J(this),this.routes=new X(this),this.similarity=new $(this),this.benchmarks=new T(this),this.multigraph=new H(this),this.basemaps=new et(this),this.fleets=new nt(this)}return Object.defineProperty(t.prototype,"endpoint",{get:function(){var t=this.serviceUrl.split("/").filter(function(t){return!!t});return t[t.length-1]},enumerable:!0,configurable:!0}),t.prototype.metadata=function(){return i(this,void 0,void 0,function(){var t,e,i;return n(this,function(n){switch(n.label){case 0:return t=this.endpoint,e=this.serviceKey,i=this.config.serverUrl+"/"+t+"/v1/metadata/network?key="+encodeURIComponent(e),[4,r().fetch(i)];case 1:return[2,n.sent()]}})})},t}(),ot=M;t.geometry=ot,t.PointsOfInterestClient=Y,t.ClientConfig=f,t.BenchmarksClient=T,t.GeocodeEsriClient=S,t.GeocodePhotonClient=w,t.MultigraphClient=H,t.OptimizationsClient=K,t.PolygonsClient=J,t.ReachabilityClient=V,t.RoutesClient=X,t.SimilarityClient=$,t.StatisticsClient=tt,t.GeocodingClients=rt,t.TargomoClient=st,t.FleetsClient=nt,t.LatLng=C,t.BoundingBox=A,t.TravelSpeedValues=_,t.StatisticValues=I,t.Route=k,t.RouteSegment=O,t.StatisticsResult=F,t.OptimizationResult=N,t.StatisticsGeometryResult=P,t.RequestsUtil=b,t.requests=r,t.SimpleLRU=v,t.SimpleCache=g,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=targomo-core.umd.min.js.map |
@@ -24,4 +24,5 @@ export interface ClientOptions { | ||
overpassUrl: string; | ||
fleetsUrl: string; | ||
requestTimeout: 20000; | ||
constructor(options: ClientOptions); | ||
} |
@@ -14,1 +14,3 @@ export * from './clientConfig'; | ||
export * from './targomoClient'; | ||
export * from './clientConfig'; | ||
export * from './fleets'; |
@@ -5,2 +5,8 @@ import { LatLngId, SRID } from '../../types'; | ||
import { TravelRequestPayload } from './travelRequestPayload'; | ||
export interface PolygonSvgOptions extends PolygonRequestOptions { | ||
serializer: 'json'; | ||
} | ||
export interface PolygonGeoJsonOptions extends PolygonRequestOptions { | ||
serializer: 'geojson'; | ||
} | ||
export declare class PolygonPayloadOptions { | ||
@@ -21,3 +27,3 @@ minPolygonHoleSize: number; | ||
polygon: PolygonPayloadOptions; | ||
constructor(client: TargomoClient, sources: LatLngId[], options: PolygonRequestOptions); | ||
constructor(client: TargomoClient, sources: LatLngId[], options: PolygonSvgOptions | PolygonGeoJsonOptions); | ||
} |
import { TargomoClient } from './targomoClient'; | ||
import { LatLngId } from '../index'; | ||
import { PolygonRequestOptions } from '../types/options/polygonRequestOptions'; | ||
import { PolygonGeoJsonOptions, PolygonSvgOptions } from './payload/polygonRequestPayload'; | ||
import { PolygonSvgResult } from '../types/responses/polygonSvgResult'; | ||
import { FeatureCollection, MultiPolygon } from 'geojson'; | ||
export declare class PolygonsClient { | ||
@@ -8,5 +10,14 @@ private client; | ||
/** | ||
* Request polygons for one or more sources from r360 service | ||
* Request geojson polygons for one or more sources from r360 service | ||
* @param sources | ||
* @param options | ||
*/ | ||
fetch(sources: LatLngId[], options: PolygonRequestOptions): Promise<{}>; | ||
fetch(sources: LatLngId[], options: PolygonGeoJsonOptions): Promise<FeatureCollection<MultiPolygon>>; | ||
/** | ||
* Request svg polygons for one or more sources from r360 service | ||
* @param sources | ||
* @param options | ||
*/ | ||
fetch(sources: LatLngId[], options: PolygonSvgOptions): Promise<PolygonSvgResult[]>; | ||
private _executeFetch(sources, options, cfg); | ||
} |
@@ -13,2 +13,4 @@ import { PointsOfInterestClient } from './pointsOfInterest'; | ||
import { MultigraphClient } from './multigraph'; | ||
import { BasemapsClient } from './basemaps'; | ||
import { FleetsClient } from './fleets'; | ||
export declare class GeocodingClients { | ||
@@ -32,2 +34,4 @@ readonly esri: GeocodeEsriClient; | ||
readonly multigraph: MultigraphClient; | ||
readonly fleets: FleetsClient; | ||
readonly basemaps: BasemapsClient; | ||
readonly config: ClientConfig; | ||
@@ -34,0 +38,0 @@ /** |
@@ -8,1 +8,2 @@ export * from './optimizationRequestOptions'; | ||
export * from './multigraphRequestOptions'; | ||
export * from './fleetRequestOptions'; |
@@ -12,5 +12,4 @@ import { TravelOptionsClientCache } from '../index'; | ||
quadrantSegments?: number; | ||
serializer?: 'json' | 'geojson'; | ||
intersectionMode?: string; | ||
decimalPrecision?: number; | ||
} |
@@ -5,3 +5,5 @@ export * from './route'; | ||
export * from './multigraphInfo'; | ||
export * from './FleetResult'; | ||
export * from './optimizationResult'; | ||
export * from './optimizationResult'; | ||
export * from './statisticsGeometryResult'; |
@@ -345,1 +345,220 @@ /** | ||
} | ||
/** | ||
* A store (also called 'depot' sometimes) to which the respective vehicles/transports and orders are associated. | ||
* Each store will be optimized individually and independently. | ||
*/ | ||
export interface FpStore { | ||
/** | ||
* Unique ID that is required to be set so that Order and Vehicle can reference to their respective store. | ||
*/ | ||
uuid: string; | ||
/** | ||
* Name of the store - cannot be longer than 256 chars. | ||
*/ | ||
name?: string; | ||
/** | ||
* Location of the store. For store addresses the geocoordinates(lat, lng) must exist already. | ||
*/ | ||
address: FpAddress; | ||
} | ||
/** | ||
* Stores, Orders, and Transports/Vehicles have addresses associated to determine their location. | ||
* Preferably these addresses are already geocoded in the WGS84 format (in lat, lng). | ||
* Otherwise, the geocoordinates are calculated during the request from the other address details (street, city, etc.). | ||
* This only happens for order addresses. For store and start or endDestination addresses geocoordinates (lat, lng) must exist already. | ||
*/ | ||
export interface FpAddress { | ||
/** | ||
* Unique ID | ||
*/ | ||
uuid?: string; | ||
/** | ||
* Amount of time it takes to carry out the order for this address in seconds. | ||
* This value is only important for addresses in orders. | ||
* - default: 0 | ||
*/ | ||
avgHandlingTime?: number; | ||
/** | ||
* Latitude of the geocoordinates in the WGS84 format of the the address. | ||
* This is required for addresses in store and transport. | ||
*/ | ||
lat?: number; | ||
/** | ||
* Longtitude of the geocoordinates in the WGS84 format of the the address. | ||
* This is required for addresses in store and transport. | ||
*/ | ||
lng?: number; | ||
name?: string; | ||
street?: string; | ||
streetDetails?: string; | ||
postalCode?: string; | ||
city?: string; | ||
country?: string; | ||
phone?: string; | ||
} | ||
/** | ||
* The order object describes the entities that need to be serviced by the transports of the same associated store. | ||
* - The physical units for weight and volume must match the units of maxWeight and maxVolume in Vehicle. | ||
* - It is not allowed to have a single Order whose weight or volume is larger than maxWeight or maxVolume of any Vehicle. | ||
* - In addition, the total weight or volume of all Orders of a Store must not exceed | ||
* the total of maxWeight or maxVolume of its associated Vehicles. | ||
* - It is sufficient to specify an order’s address without geo-coordinates. | ||
* The missing information is derived from the address details via geocoding. | ||
* This can lead to small runtime impairments for many addresses, since the geocoding accesses an external service. | ||
* The resulting geodata must not be saved. | ||
*/ | ||
export interface FpOrder { | ||
/** | ||
* To map the order entity back to the original after the request. | ||
*/ | ||
uuid?: string; | ||
/** | ||
* To associate the order entity to a store. This id must be identical with one of the uuids in the store objects. | ||
*/ | ||
storeUuid: string; | ||
/** | ||
* The location of the order. | ||
*/ | ||
address: FpAddress; | ||
/** | ||
* The deadline (time and date) for an order to be serviced. Expressed according to ISO 8601. | ||
* The optimization algorithm tries to minimize the amount of deadlines that are not kept. | ||
*/ | ||
deadline?: string; | ||
/** | ||
* The priority specifies the priority of an order. This has effects on: | ||
* - Validation: If the order number or the total order volume/weight is too high, | ||
* first orders with a lower rather than a higher priority are removed. | ||
* - Optimization: It is preferable to try to keep the deadlines of orders with higher priority. | ||
* Here, the priority of the order represents the number of penalty points it accrues for not meeting the order’s deadline. | ||
* For example, not meeting a deadline of an order with priority 10 is penalty-equivalent with not meeting the deadline of | ||
* 10 orders with priority 1. If the optimization is to have priority classes, | ||
* i.e. orders of a higher priority class are more important than infinitely many orders of a lower priority class, | ||
* we suggest the usage of a "folding technique": Consider you have 12 orders, 4 of each priority "low", "medium", and "high". | ||
* The low priority orders are assigned the value 1, the orders with medium priority are assigned the value 5, | ||
* and the orders with the high priority are assigned the value 25. | ||
* With this configuration you could always ensure that the meeting of a deadline of one higher priority order is | ||
* more important than the meeting of deadlines of all lower priority orders. | ||
* Please note that this technique can cause "NumberOverflow" errors for too many classes and orders. | ||
* - default: 1 | ||
*/ | ||
priority?: number; | ||
/** | ||
* Specifies the volume of an order. Should have the same physical unit as maxVolume in Vehicle. | ||
* It is not allowed to have a single Order whose volume is larger than maxVolume of any Vehicle. | ||
* In addition, the total volume of all Orders of a Store must not exceed the total of maxVolume of its associated Vehicles. | ||
* - default: 0 | ||
*/ | ||
volume?: number; | ||
/** | ||
* Specifies the weight of an order. Should have the same physical unit as maxWeight in Vehicle. | ||
* It is not allowed to have a single Order whose weight is larger than maxWeight of any Vehicle. | ||
* In addition, the total weight of all Orders of a Store must not exceed the total of maxWeight of its associated Vehicles. | ||
* - default: 0 | ||
*/ | ||
weight?: number; | ||
/** | ||
* A potential service comment for that order. Length cannot exceed 5000 chars. | ||
*/ | ||
comments?: string; | ||
} | ||
/** | ||
* A transport is the entity which services the orders and for which the optimization finds the best order allocations | ||
* as well as the best routes. | ||
* @param {FpVehicle} vehicle The vehicle entity describes the fixed parameters of a transport. | ||
* @param {FpTransportMetadata} metadata Metadata defining variable specifics for the vehicle/transports. | ||
*/ | ||
export interface FpTransport { | ||
vehicle: FpVehicle; | ||
metadata?: FpTransportMetadata; | ||
} | ||
/** | ||
* The vehicle entity describes the fixed parameters of a transport. | ||
* The physical units for maxWeight and maxVolume are of no relevance for the optimization. | ||
* However, the same units as in weight and volume in Order need to be used. | ||
* Parameters name, plate, avgFuelConsumption, and fuelType are currently not relevant for the optimization. | ||
*/ | ||
export interface FpVehicle { | ||
/** | ||
* To map the vehicle entity back to the original after the request. | ||
*/ | ||
uuid?: string; | ||
/** | ||
* To associate the vehicle entity to a store. This id must be identical with one of the uuids in the store objects. | ||
*/ | ||
storeUuid: string; | ||
/** | ||
* The volume capacity of this vehicle. Has to be a positive number. | ||
* The optimization will return a tour for this vehicle where this value is not exceeded. | ||
*/ | ||
maxVolume: number; | ||
/** | ||
* The weight capacity of this vehicle. Has to be a positive number. | ||
* The optimization will return a tour for this vehicle where this value is not exceeded. | ||
*/ | ||
maxWeight: number; | ||
name?: string; | ||
plate?: string; | ||
avgFuelConsumption?: number; | ||
fuelType?: string; | ||
} | ||
/** | ||
* Metadata defining variable specifics for the vehicle/transports. | ||
*/ | ||
export interface FpTransportMetadata { | ||
/** | ||
* Specifies from when on the transport would be ready to service the orders, | ||
* e.g. because right now it is still being refuelled. Expressed according to ISO 8601 | ||
* If no earliestDepartureTime is specified, it is assumed that the vehicle is immediately ready for departure. | ||
* - default: now | ||
*/ | ||
earliestDepartureTime?: string; | ||
/** | ||
* The start location of the vehicle. If no start address was specified, | ||
* the address of the store referenced in the Vehicle is assumed to be the start address of the transport's tour. | ||
* For start addresses the geocoordinates(lat, lng) must exist already. | ||
*/ | ||
start?: FpAddress; | ||
/** | ||
* The field endDestinations contains the potential end points of the vehicle. | ||
* The semantics for its configuration is: | ||
* - List empty: The last delivered order is also the end point of the route. | ||
* - One list entry: The route must end at this fixed end point. | ||
* - Multiple list entries: The selection of the best end point is part of the optimization. | ||
* If multiple endDestinations are specified, finding the best endpoint is part of the optimization. | ||
* For end destination addresses the geocoordinates(lat, lng) must exist already. | ||
*/ | ||
endDestinations?: FpAddress[]; | ||
} | ||
/** | ||
* Specifies factors with which the travel times of the edges are adjusted. | ||
* This may be necessary in certain areas where the travel time calculation is almost always off by a certain factor, e.g. Paris rush hour. | ||
*/ | ||
export interface FpTravelTimeFactors { | ||
/** | ||
* Has an effect on all edge classes (excluding transit travel times) | ||
*/ | ||
all: number; | ||
motorway: number; | ||
motorway_link: number; | ||
trunk: number; | ||
trunk_link: number; | ||
primary: number; | ||
primary_link: number; | ||
secondary: number; | ||
secondary_link: number; | ||
tertiary: number; | ||
residential: number; | ||
tertiary_link: number; | ||
road: number; | ||
unclassified: number; | ||
service: number; | ||
living_street: number; | ||
pedestrian: number; | ||
track: number; | ||
path: number; | ||
cycleway: number; | ||
footway: number; | ||
steps: number; | ||
unknown: number; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
885378
67
7658
3
+ Added@types/geojson@^7946.0.1
+ Added@types/geojson@7946.0.14(transitive)