// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,g,p,i,o,x,s,l,c,m,d,u,C,S,h,T,R,E;x="Confirmed",o=a.getSpan().nextRegExp(n.reservationId).tagContents().innerCapture(n.reservationId,1),o===a.getNullSpan()&&(o=a.getSpan().nextRegExp(n.cancelReservationId).nextAnyTag("td").tagContents()),o===a.getNullSpan()&&(o=a.getSpan().nextRegExp(n.reminderReservationId).nextAnyTag("td").tagContents()),r=a.getSpan().nextRegExp(n.guestName).tagContents().innerCapture(n.guestName,1).trim(),0===(""+r).length&&(r=a.getSpan().nextRegExp(n.guestName).tagContents().innerCapture(n.guestName,2).trim()),l=a.getSpan().nextRegExp(n.checkInDate).nextAnyTag("td").tagContents(),s=a.getSpan().nextRegExp(n.checkInTime).nextAnyTag("td").tagContents(),d=a.getSpan().nextRegExp(n.checkOutDate).nextAnyTag("td").tagContents(),m=a.getSpan().nextRegExp(n.checkOutTime).nextAnyTag("td").tagContents(),c=getFuzzyDate(a.getDetachedSpan(l+" "+s).innerDate()),u=getFuzzyDate(a.getDetachedSpan(d+" "+m).innerDate()),R=a.getSpan().nextRegExp(n.modifyUrl).nextLink(),E=a.getSpan().nextRegExp(n.cancelUrl).nextLink();var v=a.getSpan().nextRegExp(n.price).nextAnyTag("td").tagContents();if(p=v.innerCapture(/([\d,.]+)/,1),i=v.innerCapture(/([^\d,.]+)/,1).trim(),S=a.getSpan().nextRegExp(n.hotelInfo).parentTag("table2").nextTag("table3").nextTag("table3").tagContents(),""+S||!n.reminderHotelName||(S=a.getSpan().innerCapture(n.reminderHotelName,1)),!(""+S)&&n.reminderHotelName_2){var y=a.getDetachedSpan(e.subject);S=y.innerCapture(n.reminderHotelName_2,1)}if(""+S||!n.reminderHotelName_3||(S=a.getSpan().innerCapture(regExpFormatted(/\1.*\n(.*)\n/,n.reminderHotelName_3),1)),T=a.getSpan().nextRegExp(n.hotelInfo).parentTag("table2").nextTag("table3").nextTag("table3").nextTag("table3").tagContents(),T===a.getNullSpan()&&(T=a.getSpan().nextRegExp(n.hotelAddress).parentTag("table4").nextTag("table4").nextTag("table4").tagContents()),T=(""+T).split("[")[0],h=a.getSpan().firstPhoneNumber(),n.emailTitelCancelConfirmation.test(e.subject)){var v=a.getSpan().nextRegExp(n.cancelPrice).nextTag("td7").nextTag("td7").tagContents();p=v.innerCapture(/([\d,.]+)/,1),i=v.innerCapture(/([^\d,.]+)/,1).trim(),x="Cancelled"}return ASSERT(o,S,c,u),[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:r,email:g},totalPrice:p,priceCurrency:i,checkinTime:c,checkoutTime:u,modifyReservationUrl:R,cancelReservationUrl:E,reservationStatus:"http://schema.org/Reservation"+(x||"Confirmed"),reservationId:o,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:S,url:C,telephone:h,address:T}}]}}).call();