// 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,m,l,u,s=[],d={};for(n=a.getSpan().next(t.reservationId).parentAnyTag("td").tagContents().innerCapture(/(\w+)/,1),i=a.getSpan().allInnerCapture(t.passportNumber,1),l=0;l<i.length;l++)m={},m.name=i[l].parentAnyTag("table").nextAnyTag("td").tagContents(),m.seatingType=i[l].next(t.seatingType).nextAnyTag("td").tagContents(),ASSERT(m.name)&&(d[m.name]=m);var g=a.getSpan().allInnerCapture(t.departure,1);for(l=0;l<g.length;l++){var h={},c=g[l].parentAnyTag("table").allInnerTags("td3"),v=g[l].previousDate();if(o=c[1].tagContents().innerCapture(/($<name>\w+)\s+\(($<code>\w+)\)/),h.departureAirport=o.$name,h.departureCode=o.$code,h.departureTime=combineDateAndTime(v,c[2].innerDate()),o=c[4].tagContents().innerCapture(/($<name>\w+)\s+\(($<code>\w+)\)/),h.arrivalAirport=o.$name,h.arrivalCode=o.$code,h.arrivalTime=combineDateAndTime(v,c[5].innerDate()),p=c[7].innerCapture(/($<code>\w{2})\s($<number>\d+)\s/),!p)return STOP;h.airlineCode=p.$code,h.flightNumber=p.$number,ASSERT(h.departureCode,h.arrivalCode,h.departureTime,h.arrivalTime,h.flightNumber,h.airlineCode)&&s.push(h)}var C=[];for(l=0;l<s.length;l++){var T=s[l],b=Object.keys(d);for(u=0;u<b.length;u++){m=d[b[u]];var y={"@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:m.name},checkinUrl:null,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:null,priceCurrency:null,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:m.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:null,seatingType:m.seatingType}}};valid(i.membershipNumber,i.programName)&&(y.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:i.membershipNumber,programName:i.programName}),C.push(y)}}if(C.length)return C}}).call();