// 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,p,s,u,l,m,g,C,h,d,S,f,T,v,N,y;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;s=a.getSpan().innerCapture(n.reservationId,1),i=a.getSpan().innerCapture(n.guestName,1),m=a.getSpan().innerCapture(n.checkInDate,1),l=a.getSpan().innerCapture(n.checkInTime,1),h=a.getSpan().innerCapture(n.checkOutDate,1),C=a.getSpan().innerCapture(n.checkOutTime,1),g=m+""+l,d=h+""+C,g=r(g),d=r(d);var I=a.getSpan().innerCapture(n.price,1);if(c=I.innerCapture(/([\d,.]+)/,1),y=N=""+a.getSpan().innerCapture(n.modifyUrl,1),f=a.getSpan().innerCapture(n.hotelName,1),T=a.getSpan().innerCapture(n.hotelPhone,1).trim(),v=""+a.getSpan().innerCapture(n.hotelAddress,1),S=""+a.getSpan().innerCapture(n.hotelUrl,1),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(s,g,d,v))return CONTINUE;u="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(!ASSERT(s,g,d,f))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:p,checkinTime:g,checkoutTime:d,modifyReservationUrl:N,cancelReservationUrl:y,reservationStatus:"http://schema.org/Reservation"+(u||"Confirmed"),reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:f,url:S,telephone:T,address:v}}]}}).call();