// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,o,s,c,p,m,h,l,d,g,u,v,T,y,f=[],x=[],k=[],C=[];if(a.getSpan().nextText(r.hotelDetails).exists()){o=a.getSpan().nextText(r.hotelDetails).nextTag("table4"),p=o.innerText(r.reservationId).nextTag("td4").tagContents(),i=o.innerText(r.name).nextTag("td4").tagContents(),l=o.innerText(r.checkInDate).nextTag("td4").innerDate(),d=o.innerText(r.checkOutDate).nextTag("td4").innerDate(),a.getSpan().next(r.checkInTime).exists()&&(l=a.getDetachedSpan(""+l+" "+a.getSpan().innerCapture(regExpFormatted(/\1\s+(.*)/,r.checkInTime),1)).innerDate()),a.getSpan().next(r.checkOutTime).exists()&&(d=a.getDetachedSpan(""+d+" "+a.getSpan().innerCapture(regExpFormatted(/\1\s+(.*)/,r.checkOutTime),1)).innerDate()),n=o.innerTag("table5").tagContents(),g=n.innerCapture(/($<name>.*)\s($<address>[^]+)/),v=g?g.$name:null,y=g?g.$address:null,n.innerAddress().getLength()>=y.getLength()&&(y=n.innerAddress());o.innerText(r.phone).nextTag("td4").tagContents();s=a.getSpan().nextText(r.price).nextTag("td5").nextTag("td5").tagContents().innerCapture(/([\d,.]+)/,1),ASSERT(i,v,y,l,d)&&k.push({name:i,reservationId:p,totalPrice:s,priceCurrency:c,hotelName:v,hotelAddress:y,hotelUrl:u,hotelPhone:T,checkInDateTime:l,checkOutDateTime:d})}for(m=0;m<x.length;m++)for(var b=x[m],N=Object.keys(b.passengers),S=0;S<N.length;S++){var R=b.passengers[N[S]];schema={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:b.airlineName,airlineCode:b.airlineCode,flightNumber:b.flightNumber,departureAirportFuzzy:b.departureAirport,departureAirportCode:b.departureCode,departureTime:b.departureTime,arrivalAirportFuzzy:b.arrivalAirport,arrivalAirportCode:b.arrivalCode,arrivalTime:b.arrivalTime},underName:{"@type":"http://schema.org/Person",name:R.name},checkinUrl:b.checkinUrl,reservationId:b.reservationId,reservationStatus:"http://schema.org/Reservation"+(b.reservationStatus||"Confirmed"),reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:R.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:R.seats[b.flightNumber],seatingType:R.seatingType[b.flightNumber]}},totalPrice:R.totalPrice,priceCurrency:R.priceCurrency},not(R.membershipNumber)||(schema.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:R.membershipNumber,programName:R.programName}),f.push(schema)}for(m=0,h;m<C.length;m++)h=C[m],schema={"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:h.totalPrice,priceCurrency:h.priceCurrency,reservationId:h.reservationId,reservationStatus:"http://schema.org/Reservation"+(h.reservationStatus||"Confirmed"),checkinUrl:h.checkinUrl,modifyReservationUrl:h.modifyReservationUrl,cancelReservationUrl:h.cancelReservationUrl,underName:{"@type":"http://schema.org/Person",name:h.name,email:h.email},provider:{"@type":"http://schema.org/Organization",name:h.provider},pickupTime:h.pickupTime,pickupLocation:{"@type":"http://schema.org/Place",name:h.pickupName,telephone:h.pickupTelephone,address:h.pickupAddress},dropoffTime:h.dropoffTime,dropoffLocation:{"@type":"http://schema.org/Place",name:h.dropoffName,telephone:h.dropoffTelephone,address:h.dropoffAddress}},h.brand&&(schema.reservationFor={"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:h.brand},license:h.license,color:h.color}),f.push(schema);for(m=0,g;m<k.length;m++)g=k[m],schema={"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:g.name,email:g.email},totalPrice:g.totalPrice,priceCurrency:g.priceCurrency,checkinTime:g.checkInDateTime,checkoutTime:g.checkOutDateTime,modifyReservationUrl:g.modifyReservationUrl,cancelReservationUrl:g.cancelReservationUrl,reservationStatus:"http://schema.org/Reservation"+(g.reservationStatus||"Confirmed"),reservationId:g.reservationId,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:g.hotelName,url:g.hotelUrl,telephone:g.hotelPhone,address:g.hotelAddress}},f.push(schema);return f}}).call();