// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,o,p,g,l,s,d,m,u,h,T,c=[],v=[],A=[];n=a.getSpan().next(t.reservationId).nextAnyTag("td").tagContents().trim();for(var x,C,f=a.getSpan().next(t.passengers).next(t.passenger);0!==(""+f).length;)x=f.innerCapture(t.passenger),d={},d.name=x.$name,d.ticketNumber=x.$ticketNumber,ASSERT(d.name)&&(C=!0,c.push(d)),f=f.next(t.passenger);for(u=a.getSpan().next(t.flightDetails).nextTag("table5").parentTag("table4").allInnerTags("table5"),l=0;l<u.length;l++)if(m={},s=u[l].allInnerTags("td5"),s.length>2){if(!C)for(var b=s[1].next(t.passengerAlt).parentTag("table6").allInnerTags("td6"),y=0;y<b.length;y++)d={},d.name=b[y].nextTag("td7").tagContents().trim(),d.name&&(C=!0,c.push(d));h=s[0].innerCapture(t.flightInfo),m.airlineCode=h.$airlineCode,m.flightNumber=h.$flightNumber,i=s[1].innerDate(),o=s[1].next(t.departure).nextTag("td6").innerDate(),m.departureTime=combineDateAndTime(i,o),m.departureAirport=s[1].next(t.departure).nextTag("td6").tagContents().innerCapture(/(.*)\s\n/,1),m.departureAirportCode=/^([A-Z]{3}) .*/.exec(""+m.departureAirport)[1],p=s[1].next(t.arrival).nextTag("td6").innerDate(),m.arrivalTime=combineDateAndTime(i,p),m.arrivalAirport=s[1].next(t.arrival).nextTag("td6").tagContents().innerCapture(/(.*)\s\n/,1),m.arrivalAirportCode=/^([A-Z]{3}) .*/.exec(""+m.arrivalAirport)[1],m.seatingType=s[1].next(t.seat).nextTag("td7").tagContents().trim(),ASSERT(m.departureAirport,m.arrivalAirport,m.departureTime,m.arrivalTime,m.airlineCode,m.flightNumber)&&v.push(m)}T=t.bookingPending?"Pending":"Confirmed";for(var N=0;N<c.length;N++)for(d=c[N],l=0;l<v.length;l++){m=v[l];var S={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Aero M\xe9xico",airlineCode:m.airlineCode,flightNumber:m.flightNumber,departureAirportFuzzy:m.departureAirport,departureTime:m.departureTime,departureAirportCode:m.departureAirportCode,arrivalAirportFuzzy:m.arrivalAirport,arrivalTime:m.arrivalTime,arrivalAirportCode:m.arrivalAirportCode},underName:{"@type":"http://schema.org/Person",name:d.name},checkinUrl:g,reservationId:n,reservationStatus:"http://schema.org/Reservation"+T,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:d.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatingType:m.seatingType}}};A.push(S)}if(A.length)return A}}).call();