function GridScroller(e){function t(){c.scrollLeft()>0?f.addClass("active"):f.removeClass("active");var e=s.width()-c.width();c.scrollLeft()<e?d.addClass("active"):d.removeClass("active")}function n(){t();var n=c.scrollLeft(),r=n+c.width();u.removeClass("js-active").filter(function(e,t){var a=i($(t)),l=o($(t));return!(a>=r||n+1>l)}).addClass("js-active"),e.trigger("scroll-complete")}function r(e,t){c.animate({scrollLeft:i(e)},t?200:0,n)}function i(e){return Math.round(e.position().left)}function o(e){return i(e)+e.width()}function a(e){var t,n=c.scrollLeft(),a=n+c.width();if("right"===e)t=_.find(u,function(e){return a<o($(e))});else if("left"===e){var l=_.find(u.get().reverse(),function(e){return i($(e))<n});if(l){var s=o($(l)),d=s-c.width();t=_.find(u,function(e){return d<=i($(e))})}}t&&r($(t),!0)}var l=$(".grid-scroller-container",e),c=$(".grid-scroller-wrapper",l),s=$(".grid-scroller-row",c),u=$(".grid-scroller-column",s),d=$(".grid-scroller-arrow-right",e),f=$(".grid-scroller-arrow-left",e),h=l.hasClass("photo-container"),g=0,p=0,m=0;if(c.addClass("with-scrolling"),u.each(function(){var e=$(this),t=e.outerHeight(),n=e.outerWidth();p+=n,t>g&&(g=t),n>m&&(m=n)}),h){var v=$(u[0]).outerWidth(),E=u.length;s.width(v*E)}else g>0&&l.height(g),s.width(p);e.is(":visible")&&n(),d.click(function(){return a("right"),!1}),f.click(function(){return a("left"),!1}),h&&$(document).on("keyup",function(e){37===e.which?a("left"):39===e.which&&a("right")}),e.on("show-element",function(e,t,n){r($(t),n)})}function updateRecommendations(e,t){fetch("/start/components/top-cuisines?lat="+e+"&long="+t,{credentials:"include",headers:{Accept:"text/html"}}).then(function(e){return e.text()}).then(function(e){var t=$(e),n=t.find(".grid-scroller"),r="ot-grid-scroller";$(".top-cuisines-container").empty().append(t),n.data(r,new GridScroller(n)),handleAvailabilityParameters()}),$(".recommended-restaurants-container").length&&!$(".recommended-restaurants-container").is(":empty")&&fetch("/start/components/recommended-restaurants?lat="+e+"&long="+t,{credentials:"include",headers:{Accept:"text/html"}}).then(function(e){return e.text()}).then(function(e){var t=$(e),n=t.find(".grid-scroller"),r="ot-grid-scroller";$(".recommended-restaurants-container").empty().append(t),n.data(r,new GridScroller(n))})}function initScrollers(){var e=function(e){var t={latitude:e.coords.latitude,longitude:e.coords.longitude};window.OT.Common.Cookies.set({ugl:t},TWO_WEEKS),updateRecommendations(e.coords.latitude,e.coords.longitude)},t=_.once(function(){var t=window.OT.Common.Cookies.get("ugl");t&&t.latitude&&t.longitude||navigator.geolocation.getCurrentPosition(e)});"geolocation"in navigator&&(OTExperiments["rush-1834"]?$(window).scroll(function(){$(window).scrollTop()>300&&t()}):t())}function handleAvailabilityParameters(){var e=$(".top-cuisines-container a.featured-card"),t=new Date,n=17,r=1,i="19:00",o=t.getHours()<n||t.getHours()==n&&t.getMinutes()<r?!0:!1;o||t.setDate(t.getDate()+1);var a=[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-"),l="&dateTime="+[a,i].join(" ");Array.prototype.slice.call(e).forEach(function(e){var t=$(e).attr("href");$(e).attr("href",t+l)})}!function(e){function t(e){return e.length?n(r(),i(e)):!0}function n(e,t){return e.left<=t.left&&t.right<=e.right&&e.top<=t.top&&t.bottom<=e.bottom}function r(){var t=e(window),n={left:t.scrollLeft(),top:t.scrollTop()};return n.right=n.left+t.width(),n.bottom=n.top+t.height(),n}function i(e){var t=e.offset();return t.right=t.left+e.outerWidth(),t.bottom=t.top+e.outerHeight(),t}e(".js-hover-ot-menu").each(function(){var t=e("#"+e(this).attr("data-target"));e(this).hover(function(e){t.addClass("ot-menu-opened")},function(){t.removeClass("ot-menu-opened")})}),e(".js-hover-menu").each(function(){var n=e("#"+e(this).attr("data-target"));e(this).hover(function(){OT.Common.Menus.showMenu(n),n.addClass("menu-top"),t(n.find(e(this).attr("data-containment-test-selector")))||n.toggleClass("menu-top")},function(){OT.Common.Menus.closeAllMenus()})})}(jQuery),$(window).load(function(){var e="ot-grid-scroller";$(".grid-scroller").each(function(){$(this).data(e,new GridScroller($(this)))})}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.jade=e()}}(function(){return function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!l&&c)return c(a,!0);if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){var n=t[a][1][e];return i(n?n:e)},s,s.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){return null!=e&&""!==e}function i(e){return Array.isArray(e)?e.map(i).filter(r).join(" "):e}n.merge=function o(e,t){if(1===arguments.length){for(var n=e[0],i=1;i<e.length;i++)n=o(n,e[i]);return n}var a=e["class"],l=t["class"];(a||l)&&(a=a||[],l=l||[],Array.isArray(a)||(a=[a]),Array.isArray(l)||(l=[l]),e["class"]=a.concat(l).filter(r));for(var c in t)"class"!=c&&(e[c]=t[c]);return e},n.joinClasses=i,n.cls=function(e,t){for(var r=[],o=0;o<e.length;o++)t&&t[o]?r.push(n.escape(i([e[o]]))):r.push(i(e[o]));var a=i(r);return a.length?' class="'+a+'"':""},n.attr=function(e,t,r,i){return"boolean"==typeof t||null==t?t?" "+(i?e:e+'="'+e+'"'):"":0==e.indexOf("data")&&"string"!=typeof t?" "+e+"='"+JSON.stringify(t).replace(/'/g,"&apos;")+"'":r?" "+e+'="'+n.escape(t)+'"':" "+e+'="'+t+'"'},n.attrs=function(e,t){var r=[],o=Object.keys(e);if(o.length)for(var a=0;a<o.length;++a){var l=o[a],c=e[l];"class"==l?(c=i(c))&&r.push(" "+l+'="'+c+'"'):r.push(n.attr(l,c,!1,t))}return r.join("")},n.escape=function(e){var t=String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");return t===""+e?e:t},n.rethrow=function a(t,n,r,i){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&n||i))throw t.message+=" on line "+r,t;try{i=i||e("fs").readFileSync(n,"utf8")}catch(o){a(t,null,r)}var l=3,c=i.split("\n"),s=Math.max(r-l,0),u=Math.min(c.length,r+l),l=c.slice(s,u).map(function(e,t){var n=t+s+1;return(n==r?"  > ":"    ")+n+"| "+e}).join("\n");throw t.path=n,t.message=(n||"Jade")+":"+r+"\n"+l+"\n\n"+t.message,t}},{fs:2}],2:[function(e,t,n){},{}]},{},[1])(1)}),function(){this.JST||(this.JST={}),this.JST["views/recently-viewed"]=function(e){var t,n=[],r=e||{};return function(e,r){e.length>0&&(n.push('<div class="row"><div class="column"><p class="recently-viewed">Recent locations: &nbsp'),function(){var r=e;if("number"==typeof r.length)for(var i=0,o=r.length;o>i;i++){var a=r[i];n.push("<a"+jade.attr("href","/start/"+a.link,!0,!1)+' class="recent-location">'+jade.escape(null==(t=a.name)?"":t)+"</a>"),i<e.length-1&&n.push("<span>"+jade.escape(null==(t=", ")?"":t)+"</span>")}else{var o=0;for(var i in r){o++;var a=r[i];n.push("<a"+jade.attr("href","/start/"+a.link,!0,!1)+' class="recent-location">'+jade.escape(null==(t=a.name)?"":t)+"</a>"),i<e.length-1&&n.push("<span>"+jade.escape(null==(t=", ")?"":t)+"</span>")}}}.call(this),n.push("</p></div></div>"))}.call(this,"locations"in r?r.locations:"undefined"!=typeof locations?locations:void 0,"undefined"in r?r.undefined:void 0),n.join("")}}.call(this),function(e,t,n,r){n.createNS("OT.RecentlyViewed"),n.RecentlyViewed={getRecentLocations:function(){var e=[],t=JSON.parse(localStorage.getItem("otVisitedMetros"));return t&&Object.keys(t).forEach(function(n){e.push({loctype:"metro",metroId:n,count:t[n].num_visits,time:t[n].time,name:t[n].name,link:"?m="+n,true_visited:t[n].true_visited});var r=t[n].otVisitedMacros;Object.keys(r).forEach(function(i){e.push({loctype:"macro",metroId:n,macroId:i,count:r[i].num_visits,time:r[i].time,name:r[i].name,link:"?m="+n+"&mn="+i,true_visited:r[i].true_visited});var o=t[n].otVisitedMacros[i].otVisitedNeighborhoods;Object.keys(o).forEach(function(t){e.push({loctype:"neigh",metroId:n,macroId:i,neighId:t,count:o[t].num_visits,time:o[t].time,name:o[t].name,link:"?m="+n+"&mn="+i+"&n="+t,true_visited:o[t].true_visited})})})}),e.sort(function(e,t){return t.time-e.time}),e},showRecentlyViewed:function(){var t=_.filter(n.RecentlyViewed.getRecentLocations(),function(e){return e.true_visited}),i=r({locations:t.slice(0,5)});e(".recently-viewed-locations").children().length?e(".recently-viewed-locations").children().replaceWith(i):e(".recently-viewed-locations").append(i)}}}(jQuery,window,OT,JST["views/recently-viewed"]),function(e,t){OT.createNS("OT.GoogleAnalyticsClient");var n={VERSION:1,ENDPOINTS:{COLLECT:"https://www.google-analytics.com/collect"},ANONYMOUS_CLIENT_ID:"555",TRACKING_ID:"UA-52354388-1",TYPE:"event"};OT.GoogleAnalyticsClient.sendEvents=function(e){e.constructor===Array?t.each(e,function(e,t){_sendEvent(t)}):_sendEvent(e)},_getCommonPayload=function(){return{v:n.VERSION,tid:n.TRACKING_ID,cid:_getClientId(),t:n.TYPE}},_getClientId=function(){var e=OT.Common.Cookies.get("_ga");return"undefined"!==e?e.split(".").slice(2,4).join("."):n.ANONYMOUS_CLIENT_ID},_sendEvent=function(e){var r=_preparePayload(e),i=t.param(r),o=t.ajax({method:"POST",url:n.ENDPOINTS.COLLECT,data:i});o.fail(function(e){console.error("Google Analytics event protocol failed with message:",e)})},_preparePayload=function(e){return e.v&&e.tid&&e.cid&&e.t?e:t.extend(e,_getCommonPayload())}}(window,jQuery),function(e,t){OT.createNS("OT.ScrollerTracker");var n={scrollers:[],tiles:{}},r=[],i={EVENT_ACTION:"ea",EVENT_CATEGORY:"ec",CUSTOM_DIMENSION:"cd",CATEGORIES:{CLICK:"Click Event"},ACTIONS:{SCROLLER_CREATED:"Carousel created",TILE_CLICKED:"Tile clicked"},DIMENSIONS:{SCROLLER_NAME_VIEWED:"40",SCROLLER_TYPE_VIEWED:"41",SCROLLER_RANK_VIEWED:"42",TILE_NAME:"43",TILE_TYPE:"44",TILE_RANK:"45"}};OT.ScrollerTracker.setupTracking=function(){_buildScrollersModel(),_buildTilesModel(),_setupScrollersTracking(),_setupTilesTracking()},_setupScrollersTracking=function(){OT.GoogleAnalyticsClient.sendEvents(_getScrollersPayload())},_setupTilesTracking=function(){t(".grid-scroller-column").click(function(e){var t=_getTilePayloadById(_getTileId(this));OT.GoogleAnalyticsClient.sendEvents(t)})},_getScrollersPayload=function(){return n.scrollers},_buildScrollersModel=function(){t(".js-scroller").each(function(e,t){n.scrollers.push(_buildScrollerModel(e,t)),r.push(t)})},_buildScrollerModel=function(e,n){var r={},o=i.EVENT_CATEGORY,a=i.EVENT_ACTION,l=i.CUSTOM_DIMENSION+i.DIMENSIONS.SCROLLER_NAME_VIEWED,c=i.CUSTOM_DIMENSION+i.DIMENSIONS.SCROLLER_TYPE_VIEWED,s=i.CUSTOM_DIMENSION+i.DIMENSIONS.SCROLLER_RANK_VIEWED;return r[o]=i.CATEGORIES.CLICK,r[a]=i.ACTIONS.SCROLLER_CREATED,r[l]=t(n).attr("id"),r[c]=t(n).attr("data-type"),r[s]=e,r},_buildTilesModel=function(){var e="restaurant";r.length>0&&t.each(r,function(r,o){t.each(t(o).find(".js-scroller-tile"),function(t,r){var o={},a=i.EVENT_CATEGORY,l=i.EVENT_ACTION,c=i.CUSTOM_DIMENSION+i.DIMENSIONS.TILE_NAME,s=i.CUSTOM_DIMENSION+i.DIMENSIONS.TILE_TYPE,u=i.CUSTOM_DIMENSION+i.DIMENSIONS.TILE_RANK;o[a]=i.CATEGORIES.CLICK,o[l]=i.ACTIONS.TILE_CLICKED,o[c]=_getTileName(r),o[s]=e,o[u]=t,tileId=_getTileId(r),n.tiles[tileId]=o})})},_getTileId=function(e){var n=t(e),r=n.find("div[id^=rest-item-]");return 0===r.length?n.text().replace(/ /g,"-"):t(r).attr("id")},_getTilePayloadById=function(e){return e?n.tiles[e]:(console.log("Tile id invalid, returning empty payload"),{})},_getTileName=function(e){var n=t(e);if(n.attr("data-name"))return n.attr("data-name");var r=n.find("div[id^=rest-item-]"),i="list";return 0===r.length?i:t(r).attr("id").replace("rest-item-","")}}(window,jQuery),OT.Common.ImpressionsAnalytics.init({referrer:"ConsumerWeb",parentQuery:".js-scroller, .js-tab-block, .restaurant-container",query:".rest-row",logger:console.log}),function(e,t){if(e&&t)for(var n in t)e.push({event:"track_experiment_event",experiment_label:t[n]})}(window.OTDataLayer,window.GAExperimentEvents);var ZOOM_LEVEL=14,TWO_WEEKS=12096e5;$(function(){handleAvailabilityParameters(),initScrollers(),OT.ScrollerTracker.setupTracking()});