// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){function r(e){return e=e.replace(/[^\d\sa-zA-z:]+/g," ").replace(/\s+/g," ").replace(/^(\d+)\s(\d+)\s/,"$1/$2/"),e=getFuzzyDate(a.getDetachedSpan(e))}var a=Scanner.fromMessage(e);a.setLocale(t);var i,o,c,s,p,u,l,m,g,C,h,d,f,S;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;p=a.getSpan().innerCapture(n.reservationId,1),i=a.getSpan().innerCapture(n.guestName,1);var v=a.getSpan().innerCapture(n.price,1);if(c=v.innerCapture(/([\d,.]+)/,1),s=v.innerCapture(/([^\d,.]+)/,1),l=""+a.getSpan().innerCapture(n.checkInDate,1),l=r(l),m=""+a.getSpan().innerCapture(n.checkOutDate,1),m=r(m),C=a.getSpan().innerCapture(n.hotelName,1),h=a.getSpan().nextPhoneNumber().nextPhoneNumber(),d=a.getSpan().innerCapture(n.hotelAddress,1),S=a.getSpan().nextRegExp(n.cancelUrl).innerLink(),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(i,p,l,C))return CONTINUE;u="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(!ASSERT(i,p,l,C))return CONTINUE;u="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:i,email:o},totalPrice:c,priceCurrency:s,checkinTime:l,checkoutTime:m,modifyReservationUrl:f,cancelReservationUrl:S,reservationStatus:"http://schema.org/Reservation"+(u||"Confirmed"),reservationId:p,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:C,url:g,telephone:h,address:d}}]}}).call();