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