// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){if(int(e.epoch)<1388534400)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,p,o=[],l={};l[e.to]={name:e.to,seats:null,seatingType:{}};var m,s,u,d,g,c,h,v,b,T,C,N,f,y;for(n=a.getSpan().innerCapture(regExpFormatted(/\1\s+(\w+)/,t.reservationId),1),p=a.getSpan().next(t.checkinUrl).nextLink(),s=a.getSpan().next(t.flightDetails).parentTag("table4").allInnerTags("table5").map(function(e){return e.allInnerTagsFiltered("td6")}).filter(function(e){return 12===e.length}),y=0;y<s.length;y++)m=s[y],d=m[0].parentTag("table4").nextTag("td5").nextTag("td5").tagContents().innerCapture(/:\s*($<code>[A-Z]+)\s*($<flightNumber>\d+)$/),g=d?d.$code.trim():null,u=d?d.$flightNumber:null,c=m[1].innerCapture(/($<airport>.*)\s+\(($<code>[A-Z]{3})\)/),b=c?c.$code:null,v=c?c.$airport:null,T=m[7].innerCapture(/($<airport>.*)\s+\(($<code>[A-Z]{3})\)/),f=T?T.$code:null,N=T?T.$airport:null,h=combineDateAndTime(m[3].innerDate(),a.getDetachedSpan(""+m[5].innerCapture(/\d{2}:\d{2}/))),C=combineDateAndTime(m[9].innerDate(),a.getDetachedSpan(""+m[11].innerCapture(/\d{2}:\d{2}/))),ASSERT(g,u,b,h,f,C)&&o.push({airlineCode:g,flightNumber:u,departureCode:b,departureAirport:v,departureTime:h,arrivalCode:f,arrivalAirport:N,arrivalTime:C,passengers:l});var A=[];for(y=0;y<o.length;y++)for(var $=o[y],S=Object.keys($.passengers),k=0;k<S.length;k++){var F=$.passengers[S[k]],x={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:$.airlineName,airlineCode:$.airlineCode,flightNumber:$.flightNumber,departureAirportFuzzy:$.departureAirport,departureAirportCode:$.departureCode,departureTime:$.departureTime,arrivalAirportFuzzy:$.arrivalAirport,arrivalAirportCode:$.arrivalCode,arrivalTime:$.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name},checkinUrl:p,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:F.totalPrice,priceCurrency:F.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:i,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:F.seats,seatingType:F.seatingType[$.flightNumber]}}};valid(F.membershipNumber,F.programName)&&(x.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:F.membershipNumber,programName:F.programName}),A.push(x)}return A.length?A:void 0}}).call();