// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);if(a.setLocale(t),!a.getSpan().nextText(n.rentalReservedText).exists()&&!a.getSpan().nextText(n.reservationCancelledText).exists()&&!a.getSpan().nextText(n.resverationModified).exists())return CONTINUE;var r,i,o,p,s,c,g,x,l,m,u,d,T,f,h,E,S,C,b,v,y;if(a.getSpan().nextTag("table1").exists()){if(o=a.getSpan().nextText(n.confirmationNumberPrefix).parentAnyTag("td").tagContents().innerCapture(RegExp(regExpEscape(n.confirmationNumberPrefix)+"\\s+(\\w+)\\.?"),1),o.exists()||(o=a.getSpan().nextText(n.confirmationNumberAlternatePrefix).parentAnyTag("td").tagContents().innerCapture(RegExp(regExpEscape(n.confirmationNumberAlternatePrefix)+"\\s+(\\w+)\\.?"),1)),n.confirmationEmailSubjectRegExp.test(e.subject)||n.modifiedEmailSubjectRegExp.test(e.subject)){T=a.getSpan().nextText(n.personalInformationHeader).parentAnyTag("td").tagContents().innerCapture(RegExp(regExpEscape(n.personalInformationHeader)+"\\s+($<name>.*)\\s+($<email>.*)\\s")),r=T?T.$name.trim():null,i=T?T.$email:null,c=a.getSpan().nextText(n.changeReservationText+" <").nextLink(),g=a.getSpan().nextText(n.cancelReservationText+" <").nextLink();var R=a.getSpan().innerCapture(RegExp(regExpEscape(n.pricingPrefix)+"\\:? ($<totalPrice>[\\d,.]+) ($<priceCurrency>[A-Z]{3})"));x=R?R.$totalPrice:null,l=R?R.$priceCurrency:null}else n.cancellationEmailSubjectRegExp.test(e.subject)&&(r=a.getSpan().innerCapture(RegExp("\\b(.*),\\s+"+regExpEscape(n.nameSuffix)+"\\."),1).trim(),p="Cancelled");var P=a.getSpan().nextText(n.pickupHeader).nextAnyTag("td").tagContents();y=P.innerDate(),b=P.withStart(y.getEnd()).trim(),v=P.parentAnyTag("table").innerPhoneNumber();var A=P.nextText(n.returnHeader).nextAnyTag("td").tagContents();S=A.innerDate(),h=A.withStart(S.getEnd()).trim(),E=A.parentAnyTag("table").innerPhoneNumber(),not(h)&&(h=b),not(E)&&(E=v),A.nextTag("table6").innerText(n.carHeader).exists()&&(m=A.nextTag("table6").nextTag("td6").nextTag("td6").tagContents())}return ASSERT(o,r,m,b,y)?[{"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:x,priceCurrency:l,reservationId:o,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),checkinUrl:s,modifyReservationUrl:c,cancelReservationUrl:g,underName:{"@type":"http://schema.org/Person",name:r,email:i},provider:{"@type":"http://schema.org/Organization",name:"Budget"},reservationFor:{"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:m},license:u,color:d},pickupTime:y,pickupLocation:{"@type":"http://schema.org/Place",name:C,telephone:v,address:b},dropoffTime:S,dropoffLocation:{"@type":"http://schema.org/Place",name:f,telephone:E,address:h}}]:void 0}}).call();