// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e),i=a.getSpan();a.setLocale(r);var n,o=[],p=[],s=[];return n=i.nextText(t.reservationIdPrefix).nextAnyTag("td").tagContents(),i.nextText(t.passengersPrefix).parentAnyTag("td").tagContents().split("\n").slice(1).forEach(function(e){var r=e.innerCapture(/(.+):\s(\d+)/);o.push({name:r[1],ticketNumber:r[2]})}),i.allInnerTags("table5").forEach(function(e){var r,i,n,o,s,u,d,l,m,g,h;[,r,i,n]=e.nextText(t.flightNumberPrefix).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/(.+)\s\1\s(\D{2})\s(\d{1,4})/,t.flightNumberPrefix)),[o,d]=e.nextText(t.departureAirportPrefix).nextAnyTag("td").tagContents().split("\n"),[,s,o]=o.innerCapture(/(\D{3})\s(.+)/),[l,h]=e.nextText(t.arrivalAirportPrefix).nextAnyTag("td").tagContents().split("\n"),[,m,l]=l.innerCapture(/(\D{3})\s(.+)/);var c=e.nextText(t.flightNumberPrefix).nextAnyTag("td").tagContents();/\s-\s/.test(c)?[u,g]=(""+c).split("-"):(u=c,g=c),p.push({airlineName:r,airlineCode:i,flightNumber:n,departureAirport:o,departureAirportCode:s,departureDateTime:a.getDetachedSpan(""+u+" "+d).innerDate(),arrivalAirport:l,arrivalAirportCode:m,arrivalDateTime:a.getDetachedSpan(""+g+" "+h).innerDate()})}),o.forEach(function(e){p.forEach(function(r){ASSERT(e.name,r.airlineName||r.airlineCode,r.departureAirport||r.departureAirportCode,r.departureDateTime,r.arrivalAirport||r.arrivalAirportCode,r.arrivalDateTime)&&s.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:r.airlineName,airlineCode:r.airlineCode,flightNumber:r.flightNumber,departureAirportFuzzy:r.departureAirport,departureAirportCode:r.departureAirportCode,departureTime:r.departureDateTime,arrivalAirportFuzzy:r.arrivalAirport,arrivalAirportCode:r.arrivalAirportCode,arrivalTime:r.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:e.name},reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:e.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:r.seatNumber,seatingType:r.seatingType}}})})}),s.length>0?s:CONTINUE}}).call();