// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,i,g,o,s,c,p,m,x,l,u,d,C,h,T,S,f,y;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;s=a.getSpan().innerCapture(n.reservationId,1),r=a.getSpan().nextRegExp(n.guestName).nextAnyTag("td").tagContents(),i=a.getSpan().nextRegExp(n.guestEmail).nextAnyTag("td").tagContents(),m=a.getSpan().nextRegExp(n.checkInDate).nextAnyTag("td").tagContents(),p=a.getSpan().nextRegExp(n.checkInTime).nextAnyTag("td").tagContents().innerDate(),u=a.getSpan().nextRegExp(n.checkOutDate).nextAnyTag("td").tagContents(),l=a.getSpan().nextRegExp(n.checkOutTime).nextAnyTag("td").tagContents().innerDate(),u=modifyDate(m,u,0,0,0),x=getFuzzyDate(a.getDetachedSpan(m+" "+p).innerDate()),d=getFuzzyDate(a.getDetachedSpan(u+" "+l).innerDate());var E=a.getSpan().nextRegExp(n.price).nextAnyTag("td").tagContents();g=E.innerCapture(/([\d,.]+)/,1),o=E.innerCapture(/([^\d,.]+)/,1).trim(),h=a.getSpan().nextRegExp(n.hotelName).nextAnyTag("td").tagContents();var R=a.getSpan().nextRegExp(n.hotelInfo).parentAnyTag("td").tagContents();if(S=R.innerCapture(regExpFormatted(/.+\n.+\n([\s\S]*)\1/,n.hotelPhone),1),T=R.innerPhoneNumber(),y=a.getSpan().nextRegExp(n.cancelUrl).nextLink(),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(r,s,x,d,h))return CONTINUE;c="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(!ASSERT(r,s,x,d,h))return CONTINUE;c="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:r,email:i},totalPrice:g,priceCurrency:o,checkinTime:x,checkoutTime:d,modifyReservationUrl:f,cancelReservationUrl:y,reservationStatus:"http://schema.org/Reservation"+(c||"Confirmed"),reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:h,url:C,telephone:T,address:S}}]}}).call();