// 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,o,u,s,l,d,g,h,c,v,b,N=[],y={};b=a.getSpan().next(t.passengers).parentAnyTag("table"),i=b.next(t.name).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.name),1),ASSERT(i)&&(y[i]={name:i,ticketNumber:b.next(t.ticketNumber).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.ticketNumber),1),totalPrice:n,priceCurrency:m,seats:{},seatingType:{},programName:p?p.$name:null,membershipNumber:p?p.$number:null}),l={},g=a.getSpan().next(t.itinerary).nextDate(),h=g.nextTransitInformation().innerCapture(regExpFormatted(/($<airlineName>.*)\s+\1\s+($<flightNumber>\d*)/,t.flight)),l.airlineName=h.$airlineName,l.flightNumber=h.$flightNumber,o=a.getSpan().next(t.departureTime).parentAnyTag("td").innerDate(),c=o.nextAnyTag("td").tagContents().innerCapture(/($<departureFuzzy>.*)\s+-\s+($<departureCode>.*)/),l.departureCode=c.$departureCode,l.departureAirport=c.$departureFuzzy,u=a.getSpan().next(t.arrivalTime).parentAnyTag("td").innerDate(),v=u.nextAnyTag("td").tagContents().innerCapture(/($<arrivalFuzzy>.*)\s+-\s+($<arrivalCode>.*)/),l.arrivalCode=v.$arrivalCode,l.arrivalAirport=v.$arrivalFuzzy,l.departureTime=combineDateAndTime(g,o),l.arrivalTime=combineDateAndTime(g,u),ASSERT(l.flightNumber,l.departureCode,l.arrivalCode,l.departureTime,l.arrivalTime,l.airlineName)&&N.push(l);var C=[];for(s=0,d;s<N.length;s++){d=N[s];for(var T=Object.keys(y),A=0;A<T.length;A++){b=y[T[A]];var f={"@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:b.name},checkinUrl:d.checkinUrl,reservationId:d.reservationId,reservationStatus:"http://schema.org/Reservation"+(d.reservationStatus||"Confirmed"),totalPrice:b.totalPrice,priceCurrency:b.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:b.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:b.seats[d.flightNumber],seatingType:b.seatingType[d.flightNumber]}}};valid(b.membershipNumber,b.programName)&&(f.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:b.membershipNumber,programName:b.programName}),C.push(f)}}if(C.length)return C}}).call();