// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,m,p,l,o,u,s,c,h,d,g,v,C,y=[],N={};u=a.getSpan(),n=u.next(t.reservationId).innerCapture(t.reservationId,1),C=u.innerCapture(t.seating_type,1);var x;do{if(x=x?x.next(t.name_ticket):u.next(t.name_ticket),x.innerCapture(t.name_ticket)&&(p=x.innerCapture(t.name_ticket).$name),not(p)&&(x=u.next(t.name_alt),p=x.innerCapture(t.name_alt,1)),x.innerCapture(t.name_ticket)&&(i=x.innerCapture(t.name_ticket).$ticket),not(p))return CONTINUE;N[""+p]={name:p,seats:{},seatingType:C,ticketNumber:i,totalPrice:null,priceCurrency:null}}while(0!==(""+x.next(t.name_ticket)).length);if(not(p))return CONTINUE;N[""+p]={name:p,seats:{},seatingType:C,ticketNumber:null,totalPrice:null,priceCurrency:null};var b;do b=b?b.next(t.flightSummary):u.next(t.flightSummary),l=b.innerCapture(t.flightSummary),h=b.next(t.departure).nextDate(),(""+h).match(/\-/)&&(h=h.nextDate()),g=b.next(t.arrival).nextDate(),(""+g).match(/\-/)&&(g=g.nextDate()),d=b.next(t.departure).innerCapture(t.departure).$airportAddress,v=b.next(t.arrival).innerCapture(t.arrival).$airportAddress,c=l.$airlineCode,s=l.$airlineName,o=l.$flightNumber,ASSERT(c,o,d,h,v,g)&&y.push({reservationId:n,airlineName:s,airlineCode:c,flightNumber:o,departureAirport:d,departureTime:h,arrivalAirport:v,arrivalTime:g,passengers:N});while(0!==(""+b.next(t.flightSummary)).length);for(var f=[],k=0;k<y.length;k++)for(var T=y[k],A=Object.keys(T.passengers),S=0;S<A.length;S++){var _=T.passengers[A[S]],I={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:T.airlineName,airlineCode:T.airlineCode,flightNumber:T.flightNumber,departureAirportFuzzy:T.departureAirport,departureAirportCode:T.departureCode,departureTime:T.departureTime,arrivalAirportFuzzy:T.arrivalAirport,arrivalAirportCode:T.arrivalCode,arrivalTime:T.arrivalTime},underName:{"@type":"http://schema.org/Person",name:_.name},checkinUrl:m,reservationId:T.reservationId,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:null,priceCurrency:null,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:i,ticketedSeat:{"@type":"http://schema.org/Seat",seatingType:_.seatingType}}};valid(_.membershipNumber,_.programName)&&(I.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:_.membershipNumber,programName:_.programName}),f.push(I)}return f.length?f:void 0}}).call();