!function(t){function e(t){return t.length?n(o(),i(t)):!0}function n(t,e){return t.left<=e.left&&e.right<=t.right&&t.top<=e.top&&e.bottom<=t.bottom}function o(){var e=t(window),n={left:e.scrollLeft(),top:e.scrollTop()};return n.right=n.left+e.width(),n.bottom=n.top+e.height(),n}function i(t){var e=t.offset();return e.right=e.left+t.outerWidth(),e.bottom=e.top+t.outerHeight(),e}t(".js-hover-ot-menu").each(function(){var e=t("#"+t(this).attr("data-target"));t(this).hover(function(){e.addClass("ot-menu-opened")},function(){e.removeClass("ot-menu-opened")})}),t(".js-hover-menu").each(function(){var n=t("#"+t(this).attr("data-target"));t(this).hover(function(){OT.Common.Menus.showMenu(n),n.addClass("menu-top"),e(n.find(t(this).attr("data-containment-test-selector")))||n.toggleClass("menu-top")},function(){OT.Common.Menus.closeAllMenus()})})}(jQuery),function(t,e){window.OT.sendEvent=function(n,o){o=o||function(){},o=e.once(o),setTimeout(o,1e3),t.ajax("/start/events",{data:JSON.stringify({events:[n]}),type:"POST",contentType:"application/json; charset=UTF-8",success:function(){o()},error:function(){o()}})},window.OT.sendOptimizelyEvent=function(t){window.optimizely=window.optimizely||[],window.optimizely.push(["trackEvent",t])}}(jQuery,_),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.jade=t()}}(function(){return function t(e,n,o){function i(s,r){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!r&&u)return u(s,!0);if(a)return a(s,!0);throw new Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return i(n?n:t)},c,c.exports,t,e,n,o)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(t,e,n){"use strict";function o(t){return null!=t&&""!==t}function i(t){return Array.isArray(t)?t.map(i).filter(o).join(" "):t}n.merge=function a(t,e){if(1===arguments.length){for(var n=t[0],i=1;i<t.length;i++)n=a(n,t[i]);return n}var s=t["class"],r=e["class"];(s||r)&&(s=s||[],r=r||[],Array.isArray(s)||(s=[s]),Array.isArray(r)||(r=[r]),t["class"]=s.concat(r).filter(o));for(var u in e)"class"!=u&&(t[u]=e[u]);return t},n.joinClasses=i,n.cls=function(t,e){for(var o=[],a=0;a<t.length;a++)o.push(e&&e[a]?n.escape(i([t[a]])):i(t[a]));var s=i(o);return s.length?' class="'+s+'"':""},n.attr=function(t,e,o,i){return"boolean"==typeof e||null==e?e?" "+(i?t:t+'="'+t+'"'):"":0==t.indexOf("data")&&"string"!=typeof e?" "+t+"='"+JSON.stringify(e).replace(/'/g,"&apos;")+"'":o?" "+t+'="'+n.escape(e)+'"':" "+t+'="'+e+'"'},n.attrs=function(t,e){var o=[],a=Object.keys(t);if(a.length)for(var s=0;s<a.length;++s){var r=a[s],u=t[r];"class"==r?(u=i(u))&&o.push(" "+r+'="'+u+'"'):o.push(n.attr(r,u,!1,e))}return o.join("")},n.escape=function(t){var e=String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");return e===""+t?t:e},n.rethrow=function s(e,n,o,i){if(!(e instanceof Error))throw e;if(!("undefined"==typeof window&&n||i))throw e.message+=" on line "+o,e;try{i=i||t("fs").readFileSync(n,"utf8")}catch(a){s(e,null,o)}var r=3,u=i.split("\n"),c=Math.max(o-r,0),d=Math.min(u.length,o+r),r=u.slice(c,d).map(function(t,e){var n=e+c+1;return(n==o?"  > ":"    ")+n+"| "+t}).join("\n");throw e.path=n,e.message=(n||"Jade")+":"+o+"\n"+r+"\n\n"+e.message,e}},{fs:2}],2:[function(){},{}]},{},[1])(1)}),function(){this.JST||(this.JST={}),this.JST["views/autocomplete/header"]=function(t){var e,n=[],o=t||{};return function(t,o){n.push("<h6"+jade.cls(["tt-header",t],[null,!0])+"><p>"+jade.escape(null==(e=o)?"":e)+"</p></h6>")}.call(this,"iconClass"in o?o.iconClass:"undefined"!=typeof iconClass?iconClass:void 0,"title"in o?o.title:"undefined"!=typeof title?title:void 0),n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["views/autocomplete/footer"]=function(){var t=[];return t.push('<div class="tt-footer"></div>'),t.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["views/autocomplete/persistent-footer"]=function(t){var e=[],n=t||{};return function(t){e.push('<div class="tt-footer"><label><div class="before"><input name="OnlyOffers" type="checkbox"'+jade.attr("checked",t.OnlyOffers?!0:!1,!0,!1)+' class="flat"/></div><p>Special Offers only</p></label></div>')}.call(this,"ttState"in n?n.ttState:"undefined"!=typeof ttState?ttState:void 0),e.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["views/autocomplete/restaurant-suggestion"]=function(t){var e,n=[],o=t||{};return function(o,i,a,s,r){n.push("<p>"+jade.escape(null==(e=o)?"":e)+'<br/><span class="muted">'),"N"==r?n.push(jade.escape(null==(e=i.Name)?"":e)):"N,MN"==r?n.push(jade.escape(null==(e=i.Name+", "+a.Name)?"":e)):"MN,N"==r?n.push(jade.escape(null==(e=a.Name+", "+i.Name)?"":e)):s.isFunction(r)&&n.push(null==(e=r(t))?"":e),n.push("</span></p>")}.call(this,"Name"in o?o.Name:"undefined"!=typeof Name?Name:void 0,"Neighborhood"in o?o.Neighborhood:"undefined"!=typeof Neighborhood?Neighborhood:void 0,"Region"in o?o.Region:"undefined"!=typeof Region?Region:void 0,"_"in o?o._:"undefined"!=typeof _?_:void 0,"restaurantLocationName"in o?o.restaurantLocationName:"undefined"!=typeof restaurantLocationName?restaurantLocationName:void 0),n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["views/autocomplete/instruction-header"]=function(t){var e=[],n={},o=t||{};return function(t,o){if(n.instructions=function(){this&&this.block,this&&this.attributes||{};e.push("<p>Enter a local restaurant or neighborhood. Or an address, city, or zip. Or your favorite cuisine.</p>")},!o.length&&t)switch(t){case"A":e.push('<div class="tt-instruction-header tt-instruction-header-type-a"><h4>Want inspiration?</h4><span class="muted">Try these options...</span></div>');break;case"B":e.push('<div class="tt-instruction-header tt-instruction-header-type-b">'),n.instructions(),e.push("</div>");break;case"C":e.push('<div class="tt-instruction-header tt-instruction-header-type-c">'),n.instructions(),e.push('<div class="icons"><span class="icon-restaurant-outline"></span><span class="icon-map-outline"></span><span class="icon-cuisine-outline"></span></div></div>')}}.call(this,"instructionType"in o?o.instructionType:"undefined"!=typeof instructionType?instructionType:void 0,"query"in o?o.query:"undefined"!=typeof query?query:void 0),e.join("")}}.call(this),function(t){function e(t,e){for(var n=0;n<t.length;n++){var o=t[n];e(o)}}function n(){var e=t(this);e.typeahead("close"),setTimeout(function(){e.focus();var t=e.typeahead("val");e.typeahead("val",t+" "),e.typeahead("val",t)},400)}function o(t,e){this.$dtpInput=t,this.options=e,this.init()}var i={flash:n},a="ot-dtp-autocomplete";t.fn.dtpAutocomplete=function(e){this.each(function(){var n=t(this);if("string"==typeof e)i[e].call(this);else{var s=n.data(a);s||(s=new o(n,e),n.data(a,s))}})},o.prototype.init=function(){function n(e,n){var o=new Bloodhound({limit:20,name:e,remote:{url:l.options.url,replace:function(e,n){var o=_.extend({term:n},l.options.query);return e+"?"+t.param(o)},filter:n},datumTokenizer:function(t){return Bloodhound.tokenizers.whitespace(t.Name)},queryTokenizer:Bloodhound.tokenizers.whitespace});return o.initialize(),o}function o(t){return t.Locations.length+t.Restaurants.length+t.Cuisines.length}function i(t,e){var n,i=o(t);return n=20>i?15:5,e.slice(0,n)}function a(){var t=l.$dtpInput.typeahead("val");return h.index.get(t)}function s(t){l.$dtpInput.data("tt-selected",t)}function r(){return JST["views/autocomplete/persistent-footer"]({ttState:g})}function u(t){return'<div class="tt-header"><p>'+l.options.noResultsTemplate.replace("%QUERY",t.query)+"</p></div>"}function c(t){return t.restaurantLocationName=l.options.restaurantLocationName,JST["views/autocomplete/restaurant-suggestion"](t)}function d(t,e){return function(n,o){n.length>=e?t(n,o):o([])}}function p(t){return t.displayKey="Name",t.source=d(t.bloodhoundSource.ttAdapter(),T),t.templates.footer=JST["views/autocomplete/footer"](),t}var l=this,h=n("NoResultsIndex");h.add(l.options.noResultsAreaList);var f=n("Restaurants",function(t){return e(t.Restaurants,function(t){t.Type="Restaurant"}),i(t,t.Restaurants)}),m=n("Location",function(t){return t=i(t,t.Locations),t.length?t:a()}),y=n("NoResults",function(t){var e=o(t)+a().length;return 0===e?i(t,l.options.noResultsAreaList):[]}),v=n("Cuisines",function(t){return e(t.Cuisines,function(t){t.Type="Cuisine"}),t.Cuisines}),g={OnlyOffers:!1};this.$dtpInput.data("tt-state",g);var T=this.options.typeaheadMinLength,I=[];I.push(p({name:"Locations",bloodhoundSource:m,templates:{header:this.headerTemplate({iconClass:"icon-location-mini",title:this.options.locationsTranslation})}})),this.options.disableRestaurants||I.push(p({name:"Restaurants",bloodhoundSource:f,templates:{header:this.headerTemplate({iconClass:"icon-building",title:this.options.restaurantsTranslation}),suggestion:c}})),I.push(p({name:"NoResults",bloodhoundSource:y,templates:{header:u}})),this.options.disableCuisines||I.unshift(p({name:"Cuisines",bloodhoundSource:v,templates:{header:this.headerTemplate({iconClass:"icon-cuisine",title:"Cuisines"})}})),I=I.concat(this.getInstructionDatasets()),this.options.IsSpecialOffersOnlyVisible&&I.push({name:"Footer",source:function(t,e){e([])},templates:{empty:" ",footer:r}}),this.$dtpInput.typeahead({minLength:0,highlight:!0,hint:!0},I).on("typeahead:selected",function(t,e){s(e)}).on("typeahead:autocompleted",function(t,e){s(e)});var N=this.$dtpInput.data("ttTypeahead");N.input.onSync("focused",function(){N.dropdown.update(l.$dtpInput.typeahead("val")),l.hasInputBeenFocused=!0}),N.dropdown.onSync("datasetRendered",function(){var e=l.$dtpInput.closest(".twitter-typeahead");OT.checkboxes.check(e),e.find("input").on("ifChanged",function(e){g.OnlyOffers=t(e.target).prop("checked")})}),N.dropdown.onAsync("datasetRendered",function(){var t=l.$dtpInput.data("ttTypeahead"),e=t.input.$hint;t.isActivated&&(g.lastHint=e.val()&&t.dropdown.isVisible()?t.dropdown.getDatumForTopSuggestion().raw:null)})},o.prototype.headerTemplate=JST["views/autocomplete/header"],o.prototype.showInstruction=function(t){this.instructionType=t,"A"===t&&this.showSFRecommendations(),this.hasInputBeenFocused||this.$dtpInput.focus()},o.prototype.getInstructionDatasets=function(){function t(t){return t.source=function(o,i){if(o.length)i([]);else{var a=n.instructionData[t.name]||[];e(a,function(t){t.Static=!0}),i(a)}},t.displayKey="Name",t.templates.footer=JST["views/autocomplete/footer"](),t}var n=this,o=[];return n.instructionData={},o.push({name:"Instruction",source:function(t,e){e([])},templates:{empty:function(t){return t.instructionType=n.instructionType,JST["views/autocomplete/instruction-header"](t)}}}),o.push(t({name:"TrendingRestaurants",templates:{header:this.headerTemplate({iconClass:"icon-building",title:"Trending Restaurants"})}})),o.push(t({name:"Nearby",templates:{header:this.headerTemplate({iconClass:"icon-location-mini",title:"Nearby Neighborhoods"})}})),o.push(t({name:"PopularCuisines",templates:{header:this.headerTemplate({iconClass:"icon-cuisine",title:"Popular Cuisines"})}})),o},o.prototype.showSFRecommendations=function(){var t={Id:4,Name:"San Francisco Bay Area"};this.instructionData={TrendingRestaurants:[{Id:7740,Name:"Slanted Door",Metro:t,Type:"Restaurant"},{Id:147469,Name:"Monsieur Benjamin",Metro:t,Type:"Restaurant"},{Id:1935,Name:"Kokkari Estiatorio",Metro:t,Type:"Restaurant"}],PopularCuisines:[{Id:14,Name:"Italian",Type:"Cuisine"},{Id:25,Name:"Sushi",Type:"Cuisine"},{Id:19,Name:"Seafood",Type:"Cuisine"}],Nearby:[{Name:"Financial District / Embarcadero",Type:"Neighborhood",Metro:t,Region:{Id:5,Name:"San Francisco"},Neighborhood:{Id:227,Name:"Financial District / Embarcadero"}},{Name:"Downtown / Union Square",Type:"Neighborhood",Metro:t,Region:{Id:5,Name:"San Francisco"},Neighborhood:{Id:35,Name:"Downtown / Union Square"}},{Name:"Civic Center / Hayes Valley / Van Ness",Type:"Neighborhood",Metro:t,Region:{Id:5,Name:"San Francisco"},Neighborhood:{Id:34,Name:"Civic Center / Hayes Valley / Van Ness"}}]}}}(jQuery),function(t){function e(t,e){var o=this;this.$el=t,this.options=e,t.find(".dtp-picker-search").dtpAutocomplete(e.autocomplete),OT.Events.on("dtp:search",function(i,a){if(a.sender.is(t)){var s=a.sender.find(".dtp-picker-search.tt-input"),r=s.data("tt-selected")||{},u=s.data("tt-state")||{},c=s.val().length,d={DateTime:a.datetime,Covers:a.covers,OnlyOffers:u.OnlyOffers},p={};r.Type?p=r:u.lastHint&&u.lastHint.Type&&(p=u.lastHint);var l=!c&&e.metroId;o.logQueryType({$autoCompleteElem:s,autoCompleteResult:p,canSearchBasedOnCurrentLocation:l,options:e},function(){if(p.Type||l){var t=n(p,d,e);document.location.href=t}else s.dtpAutocomplete("flash")})}})}function n(e,n,o){function i(t){var e={m:t.MetroId,p:t.Covers,d:t.DateTime};return t.RegionIds&&(e.mn=t.RegionIds),t.NeighborhoodIds&&(e.n=t.NeighborhoodIds),e}var a="21"===n.Covers;if(e.Type)switch(e.IsAlias&&(n.Title=e.Name),e.Type){case"PointOfInterest":n.Title=e.Name,n.Distance=e.DefaultRadius,n.Latitude=e.GeoLocation.Latitude,n.Longitude=e.GeoLocation.Longitude,a&&(n.MetroId=e.Metro.Id);break;case"Restaurant":n.RestaurantIDs=e.Id,n.MetroId=e.Metro.Id;break;case"Cuisine":n.CuisineIds=e.Id,n.MetroId=o.metroId,n.RegionIds=o.macroId,n.NeighborhoodIds=o.neighborhoodId;break;case"Neighborhood":n.NeighborhoodIds=e.Neighborhood.Id,n.RegionIds=e.Region.Id,n.MetroId=e.Metro.Id;break;case"Region":n.RegionIds=e.Region.Id,n.MetroId=e.Metro.Id;break;case"Metro":n.MetroId=e.Metro.Id}else n.MetroId=o.metroId,n.RegionIds=o.macroId,n.NeighborhoodIds=o.neighborhoodId;var s,r;return a?(n=i(n),s=o.redirectionHosts.privateDining,r="start:dtp:private-dining"):n.RestaurantIDs?(s=o.redirectionHosts.singleSearchBase+n.RestaurantIDs,r="start:dtp:single"):(s=o.redirectionHosts.multiSearch,r="start:dtp:multi"),window.OT.sendOptimizelyEvent(r),s+"?"+t.param(n)}var o="ot-dtp-submit";t.fn.dtpSubmit=function(n){this.each(function(){var i=t(this),a=i.data(o);a||(a=new e(i,n),i.data(o,a))})},e.prototype.logQueryType=function(t,e){var n,o,i=t.$autoCompleteElem,a=t.autoCompleteResult,s=t.canSearchBasedOnCurrentLocation,r=t.options,u=i.typeahead("val"),c={type:"ds-autocomplete-submit",query:u,result:a,userAgent:window.navigator.userAgent,currentPage:r.currentPage};"Restaurant"===a.Type?(c.queryType="RESTAURANT",n=a.Static?"start:dtp:restaurant-static":"start:dtp:restaurant"):"Cuisine"===a.Type?(c.queryType="CUISINE",n=a.Static?"start:dtp:cuisine-static":"start:dtp:cuisine"):a.Type?(c.queryType="LOCATION",n=a.Static?"start:dtp:location-static":"start:dtp:location"):s?(c.queryType="UNKNOWN",r.metroId&&(c.metroId=r.metroId),r.macroId&&(c.macroId=r.macroId),r.neighborhoodId&&(c.neighborhoodId=r.neighborhoodId),n="start:dtp:unknown-query",o=!0):(c.queryType="CURRENT-LOCATION",n="start:dtp:current-location"),o||window.OT.sendOptimizelyEvent("start:dtp:known-query"),window.OT.sendOptimizelyEvent("start:dtp:any-query"),window.OT.sendOptimizelyEvent(n),window.OT.sendEvent(c,e)}}(jQuery),$(function(){});