// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var r=Scanner.fromMessage(e);r.setLocale(t);var a,i,s,o,x,c,g,d,m,u,h,p,f;if(n.reservationCancelled.test(e.subject))f="Cancelled";else{if(!n.confirmation.test(e.subject))return CONTINUE;f="Confirmed"}var l=r.getSpan().next(n.reservationIdPrefix);g=l.nextTag("td3").tagContents(),a=l.next(n.underPersonNamePrefix).nextTag("td3").tagContents().innerCapture(regExpFormatted(/(.*)\1/,n.underPersonNameSuffix),1).trim(),s=l.next(n.hotelNamePrefix).nextTag("td3").tagContents(),s.exists()&&(s=(""+s).replace(/\s*<.+>/,"")),o=l.next(n.hotelPhonePrefix).nextTag("td3").tagContents(),c=l.next(n.hotelAddressPrefix).nextTag("td3").tagContents(),c.exists()&&(c=(""+c).replace(/\s*<.+>/,""));var C=l.next(n.pricePrefix).nextTag("td3").tagContents();d=l.next(n.checkInDateTimePrefix).nextTag("td3").innerDate();var T=l.next(n.stayLengthPrefix).nextTag("td3").tagContents().innerCapture(/(\d+)/,1);return u=l.next(n.checkOutTimePrefix).nextTag("td3").tagContents(),T&&(m=modifyDate(d,int(""+T)),u&&(m=combineDateAndTime(m,u))),h=C.innerCapture(/([\d,.]+)/,1),p=C.innerCapture(/([^\d,.]+)/,1),p.exists()&&(p=(""+p).replace(/\s*\uff08.+\uff09/,"")),ASSERT(d,c)?[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:a,email:i},totalPrice:h,priceCurrency:p,checkinTime:d,checkoutTime:m,reservationStatus:"http://schema.org/Reservation"+f,reservationId:g,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:s,telephone:o,url:x,address:c}}]:CONTINUE}}).call();