// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,m,l=[],g={};for(n=a.getSpan().next(t.reservationId).parentAnyTag("td").tagContents().innerCapture(/(\w+)/,1),i=a.getSpan().allInnerCapture(t.passportNumber,1),o=0;o<i.length;o++)p={},p.name=i[o].parentAnyTag("table").nextAnyTag("td").tagContents(),p.seatingType=i[o].next(t.seatingType).nextAnyTag("td").tagContents(),ASSERT(p.name)&&(g[p.name]=p);var s=a.getSpan().allInnerCapture(t.flightRegex,1);for(o=0;o<s.length;o++){var u={},d=s[o].parentAnyTag("td").tagContents().innerCapture(/($<code>\w{2})\s($<number>\d+)/);u.airlineCode=d.$code,u.flightNumber=d.$number;var h=s[o].parentTag("table3").allInnerTags("td3"),c=h[0].previousDate();u.departureTime=combineDateAndTime(c,h[0].innerDate()),u.arrivalTime=combineDateAndTime(c,h[1].innerDate()),u.departureCode=h[0].tagContents().innerCapture(/(\w{3})/,1),u.arrivalCode=h[1].tagContents().innerCapture(/(\w{3})/,1),u.seatingType=s[o].innerCapture(regExpFormatted(/\1\s+(.*)/,t.seatingType),1),ASSERT(u.departureCode,u.arrivalCode,u.departureTime,u.arrivalTime,u.flightNumber,u.airlineCode)&&l.push(u)}var v=[];for(o=0;o<l.length;o++){var C=l[o],T=Object.keys(g);for(m=0;m<T.length;m++){p=g[T[m]];var b={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:C.airlineName,airlineCode:C.airlineCode,flightNumber:C.flightNumber,departureAirportFuzzy:C.departureAirport,departureAirportCode:C.departureCode,departureTime:C.departureTime,arrivalAirportFuzzy:C.arrivalAirport,arrivalAirportCode:C.arrivalCode,arrivalTime:C.arrivalTime},underName:{"@type":"http://schema.org/Person",name:p.name},checkinUrl:null,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:null,priceCurrency:null,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:p.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:null,seatingType:C.seatingType}}};valid(i.membershipNumber,i.programName)&&(b.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:i.membershipNumber,programName:i.programName}),v.push(b)}}if(v.length)return v}}).call();