text: class DBHelper{static get DATABASE_URL(){const t="/assets/data/restaurants.json";return window.location.hostname.includes("localhost")?`${window.location.protocol}//${window.location.hostname}:${window.location.port}${t}`:`https://tsuna-mi.github.io/mws-restaurant${t}`}static fetchRestaurants(t){const e=new XMLHttpRequest;e.open("GET",DBHelper.DATABASE_URL),e.onload=(()=>{if(200===e.status){const s=JSON.parse(e.responseText).restaurants;t(null,s)}else{const s=`Request failed. Returned status of ${e.status}`;t(s,null)}}),e.send()}static fetchRestaurantById(t,e){DBHelper.fetchRestaurants((s,n)=>{if(s)e(s,null);else{const s=n.find(e=>e.id==t);s?e(null,s):e("Restaurant does not exist",null)}})}static fetchRestaurantByCuisine(t,e){DBHelper.fetchRestaurants((s,n)=>{if(s)e(s,null);else{const s=n.filter(e=>e.cuisine_type===t);e(null,s)}})}static fetchRestaurantByNeighborhood(t,e){DBHelper.fetchRestaurants((s,n)=>{if(s)e(s,null);else{const s=n.filter(e=>e.neighborhood===t);e(null,s)}})}static fetchRestaurantByCuisineAndNeighborhood(t,e,s){DBHelper.fetchRestaurants((n,a)=>{if(n)s(n,null);else{let n=a;"all"!==t&&(n=n.filter(e=>e.cuisine_type===t)),"all"!==e&&(n=n.filter(t=>t.neighborhood===e)),s(null,n)}})}static fetchNeighborhoods(t){DBHelper.fetchRestaurants((e,s)=>{if(e)t(e,null);else{const e=s.map((t,e)=>s[e].neighborhood),n=e.filter((t,s)=>e.indexOf(t)===s);t(null,n)}})}static fetchCuisines(t){DBHelper.fetchRestaurants((e,s)=>{if(e)t(e,null);else{const e=s.map((t,e)=>s[e].cuisine_type),n=e.filter((t,s)=>e.indexOf(t)===s);t(null,n)}})}static urlForRestaurant(t){return`./restaurant.html?id=${t.id}`}static imageUrlForRestaurant(t){return`./assets/img/${t.photograph}`}static mapMarkerForRestaurant(t,e){const s=window.google,n={url:"./assets/img/restaurant-icon.svg",scaledSize:new s.maps.Size(50,50)};return new s.maps.Marker({position:t.latlng,title:t.name,url:DBHelper.urlForRestaurant(t),icon:n,map:e,animation:s.maps.Animation.DROP})}}
  //# sourceMappingURL=maps/dbhelper.js.map
  