// 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,p,c,u,m,C,l,h,x,d,S,T,E,R;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;if(n.emailTitelConfirmation.test(e.subject)){s=a.getSpan().innerCapture(regExpFormatted(/\1 ([0-9]*)/,n.reservationId),1),R=E=a.getSpan().next(n.reservationId).parentAnyTag("td").tagContents().innerLink(),r=a.getSpan().nextRegExp(n.guestName).tagContents().innerCapture(n.guestName,1),i=a.getSpan().nextRegExp(n.guestEmail).tagContents().innerCapture(n.guestEmail,1),u=a.getSpan().nextRegExp(n.checkInDate).tagContents().innerCapture(n.checkInDate,1),l=a.getSpan().nextRegExp(n.checkOutDate).tagContents().innerCapture(n.checkOutDate,1),c=a.getSpan().nextRegExp(n.checkInTime).tagContents().innerCapture(n.checkInTime,1),C=a.getSpan().nextRegExp(n.checkOutTime).tagContents().innerCapture(n.checkOutTime,1),m=getFuzzyDate(a.getDetachedSpan(u+" "+c).innerDate()),h=getFuzzyDate(a.getDetachedSpan(l+" "+C).innerDate());var f=a.getSpan().nextRegExp(n.price).nextAnyTag("td").tagContents();g=f.innerCapture(/([\d,.]+)/,1),o=f.innerCapture(/([^\d,.]+)/,1).trim();var v=a.getSpan().nextRegExp(n.hotel).parentTag("td4").tagContents();if(S=v.innerPhoneNumber(),T=a.getSpan().nextRegExp(n.hotelAddress).tagContents().innerCapture(n.hotelAddress,1).trim(),d=a.getSpan().nextRegExp(n.hotel).nextAnyTag("td").nextAnyTag("td").tagContents(),d.split("\n").length>1&&(d=d.split("\n")[0]),x=a.getSpan().nextRegExp(n.hotelUrl).parentAnyTag("td").tagContents().innerLink(),!ASSERT(r,s,m,h,T))return CONTINUE;p="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(!ASSERT(r,s,m,h,T))return CONTINUE;p="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:m,checkoutTime:h,modifyReservationUrl:E,cancelReservationUrl:R,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:d,url:x,telephone:S,address:T}}]}}).call();