// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n,a){if(!(e&&t&&n&&a))return CONTINUE;var r=Scanner.fromMessage(e);r.setLocale(t);var o=loadHelper("opentable-restaurant-invitation-check.js");if(o(e))return STOP;var p,x,s,g,i,h,T,d,l,S;return s=r.getSpan().nextText(n.hour),s=getFuzzyDate(r.getDetachedSpan((""+r.getSpan().withInterval(s.nextText("\n").getEnd(),s.nextText("\n").nextText("\n").getStart())).replace(/[^\d\sa-zA-z:]+/g,"").replace(/\s+/g," ").replace(/^(\d+)\s(\d+)\s/,"$1/$2/"))),x=r.getSpan().nextText(n.restaurant).nextText(n.restaurant),x=r.getSpan().withInterval(x.nextText("\n").getEnd(),x.nextText("\n").nextText("\n").getStart()),d=r.getDetachedSpan((""+r.getSpan().nextText(n.phone).previousText(""+x).collapseToEnd().withEnd(r.getSpan().nextText(n.phone).previousText("\n").getStart()).trim()).replace(/(\n)/g," ")),h=r.getSpan().nextText(n.phone).nextPhoneNumber().innerCapture(regExpFormatted(/([\d\(\)\-\s]+)/),1).trim(),h.exists()||(h=r.getSpan().nextText(n.phone),h=r.getSpan().withInterval(h.nextText("\n").getEnd(),h.nextText("\n").nextText("\n").getStart())),p=r.getSpan().nextText(n.person),p=r.getSpan().withInterval(p.previousText("\n").getEnd(),p.nextText("\n").getStart()).innerCapture(regExpFormatted(/(\d+)/),1),g=r.getSpan().innerCapture(regExpFormatted(/(.*) \1/,n.invitation),1),ASSERT(p,x,s,g)?[{"@context":"http://schema.org","@type":"http://schema.org/FoodEstablishmentReservation",partySize:p,reservationId:T,reservationStatus:"http://schema.org/ReservationConfirmed",reservationFor:{"@type":"http://schema.org/FoodEstablishment",name:x,url:i,telephone:h,address:d},startTime:s,bookingAgent:{"@type":"http://schema.org/Organization",name:"OpenTable",url:"https://"+a},underName:{"@type":"http://schema.org/Person",name:g},cancelReservationUrl:l,modifyReservationUrl:S}]:CONTINUE}}).call();