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