// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){if(!e||!t||!n)return CONTINUE;var r=Scanner.fromMessage(e);r.setLocale(t);var a,i,o,g,p,x,d,s,c,m,h,u,S;if("html"===n.version)g=r.getSpan().innerCapture(regExpFormatted(/\1 (\d+)/,n.confirmationNumber),1),s=getFuzzyDate(r.getSpan().nextText(n.checkin).withEnd(r.getSpan().nextText(n.checkout).getStart())),c=getFuzzyDate(r.getSpan().nextText(n.checkout).withEnd(r.getSpan().nextText(n.checkout).parentAnyTag("td").getEnd())),x=r.getSpan().nextText(n.modifyReservationUrl).nextLink(),d=x,m=r.getSpan().nextText(n.hotelUrl).nextLink(),p=r.getSpan().nextText(n.reservationDetails).withEnd(r.getSpan().nextText(n.summary).getStart()),h=p.innerCapture(regExpFormatted(/\1 (.*)\s/,n.hotelName),1),a=p.innerCapture(regExpFormatted(/\1 (.*)\s/,n.name),1),i=r.getSpan().nextText(n.totalPrice).nextTag("td1").tagContents(),o=r.getSpan().innerCapture(regExpFormatted(/\1 \(([A-Z]{2,3})/,n.priceCurrency),1),p=r.getSpan().withEnd(r.getSpan().nextTag("table1").getStart()),u=p.innerCapture(regExpFormatted(/\1 (.+?) \2/,n.phone,n.fax),1),valid(h,u,p)&&(S=p.withStart(h.getLength()).withEnd(p.innerText(n.phone).getStart()).trim(),p.innerAddress().getLength()>=S.getLength()&&(S=p.innerAddress()));else if("txt"===n.version&&(p=r.getSpan().nextText(n.reservationDetails).withEnd(r.getSpan().nextText(n.planningYourTrip).getStart()),valid(p))){g=p.innerCapture(regExpFormatted(/\1 (\d+)\n/,n.confirmationNumber),1),s=r.getSpan().next(n.checkin).nextDate(),c=r.getSpan().next(n.checkout).nextDate(),a=p.innerCapture(regExpFormatted(/\1 (.*)\n/,n.guestName),1).trim();var l=r.getSpan().innerCapture(regExpFormatted(/^($<name>.*)\n($<address>[^]+)\n\1 ($<phone>.*)\n/,n.phone));l&&(h=l.$name,S=l.$address,u=l.$phone),m=r.getSpan().nextText(n.hotelUrl).nextLink(),x=p.innerText(n.modifyUrl).nextLink(),d=x,i=p.innerCapture(regExpFormatted(/\1 .* - ([\d,.]+)/,n.totalPrice),1),o=p.innerCapture(regExpFormatted(/\1 \(([A-Z]{3})\)/,n.priceCurrency),1)}return ASSERT(s,c,S)?[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:a},totalPrice:i,priceCurrency:o,checkinTime:s,checkoutTime:c,modifyReservationUrl:x,cancelReservationUrl:d,reservationStatus:"http://schema.org/ReservationConfirmed",reservationId:g,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:h,url:m,telephone:u,address:S}}]:void 0}}).call();