// 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,g,l,d=[],u=[];for(i=a.getSpan().innerCapture(regExpFormatted(/\1(.*)/,t.booking),1).trim(),n=a.getSpan().next(t.checkIn).nextLink(),p=a.getSpan().next(t.where);p.nextTag("table4").next(t.seat).exists();){var h,s,c=p.nextTag("table4"),v={},T=a.getSpan().withInterval(p.getEnd(),c.getStart());v.airlineName=T.innerCapture(regExpFormatted(/\1(.*)/,t.operated),1).trim(),v.airlineName.exists()||(v.airlineName=a.getDetachedSpan("Virgin Atlantic")),h=T.innerCapture(regExpFormatted(/\1 ($<code>[A-Z]{2,3})($<num>\d+)/,t.flight)),h&&(v.airlineCode=h.$code,v.flightNumber=h.$num),s=T.trim().innerCapture(regExpFormatted(/\w+ ($<dep>.*) \1 ($<arrival>.*)\//,t.to)),s&&(v.departureAirport=s.$dep,v.arrivalAirport=s.$arrival),v.departureTime=c.innerTag("tr4").nextTag("tr4").innerDate(),v.arrivalTime=v.departureTime.nextDate(),ASSERT(v.departureAirport,v.arrivalAirport,v.departureTime,v.arrivalTime,v.flightNumber)&&d.push(v),p=c.collapseToEnd()}m=a.getSpan().nextTag("table4").allInnerTags("tr4");for(var x=1;x<m.length;x++){var b={},C=m[x];b.name=C.innerTag("td4").tagContents(),ASSERT(b.name)&&u.push(b)}o=a.getSpan().next(t.total).nextTag("td4").tagContents(),g=o.innerCapture(/([\d\.,]+)/,1),l=o.innerCapture(/([A-Z]{3})/,1);for(var N=[],x=0;x<d.length;x++)for(var S=d[x],A=0;A<u.length;A++){var f=u[A],y={"@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:f.name,email:f.email},checkinUrl:n,reservationId:i,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:g,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:""}}};f.membershipNumber&&f.programName&&(y.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:f.membershipNumber,programName:f.programName}),N.push(y)}if(N.length)return N}}).call();