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