// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a,i,n,p,o,l,m,u,d,s,h=[],g={},v=Scanner.fromMessage(e);for(v.setLocale(r),n=v.getSpan().innerCapture(regExpFormatted(/\1\n\n(.*)/,t.reservationId),1),d=v.getSpan().allTransitInformation(),o=0;o<d.length;o++){u={};var c=d[o].previousDate();for(m=!1,l=0;l<2*d.length&&!m;l++)hasTime_(unSpanDate_(c))||(m=c),c=c.previousDate();a=d[o].nextDate(),u.departureCode=a.parentAnyTag("td").innerCapture(/\((.*?)[\)\s-]/,1),i=a.nextDate(),u.arrivalCode=i.parentAnyTag("td").innerCapture(/\((.*?)[\)\s-]/,1),s=d[o].innerCapture(/($<airlineCode>\D+)\s+($<flightNumber>\d+)/),u.airlineCode=s.$airlineCode,u.flightNumber=s.$flightNumber,u.departureTime=combineDateAndTime(m,a),u.arrivalTime=combineDateAndTime(m,i),Date.parse(u.departureTime)>Date.parse(u.arrivalTime)&&(u.arrivalTime=modifyDate(u.arrivalTime,1)),ASSERT(u.departureTime,u.arrivalTime,u.airlineCode,u.flightNumber,u.departureCode,u.arrivalCode)&&h.push(u)}g=v.getSpan().allInnerCapture(/\[table4\]\s\[tr4\]\s\[td4\]([^\[\]:><\uff1a\/]{4,})\[\/td4\]\s\[td4\]\s{3}/,1),ASSERT(g.length>0);var T,C=[];for(o=0;o<h.length;o++){u=h[o];for(var l=0;l<g.length;l++){var b=(""+g[l]).trim();T={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:u.airlineCode,flightNumber:u.flightNumber,departureAirportFuzzy:u.departureAirport,departureAirportCode:u.departureCode,departureTime:u.departureTime,arrivalAirportFuzzy:u.arrivalAirport,arrivalAirportCode:u.arrivalCode,arrivalTime:u.arrivalTime},underName:{"@type":"http://schema.org/Person",name:b},checkinUrl:p,reservationId:n,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:null,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:null,seatingType:null}},totalPrice:null,priceCurrency:null,reservationStatus:"http://schema.org/ReservationConfirmed"},valid(b.membershipNumber)&&(T.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:b.membershipNumber,programName:"Frequent Flyer"}),C.push(T)}}if(C.length)return C}}).call();