// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,o,p,g,l,d,s=a.getSpan(),u="Confirmed",c=[],m=[];n=s.next(r.underPersonName_prefix).nextAnyTag("td").nextAnyTag("td").tagContents(),i=s.next(r.reservationId_prefix).nextAnyTag("td").tagContents();var T=s.next(r.totalPrice_prefix).nextAnyTag("td").tagContents();T=/^(.)(.*)/.exec(T),p=T[1],o=T[2],g=s.next(r.checkinUrl_prefix).nextLink(),l=d=s.next(r.modifyReservationUrl_prefix).nextLink();var h=s.next(r.flightLegs_prefix).nextTag("table5").allInnerTags("tr5");h.forEach(function(e,t){var a=e.nextAnyTag("td").tagContents();r.detectNewLeg.test(a)&&c.push(h[t]+h[t+1]+h[t+2]+h[t+5])});var x=function(e,t){e.forEach(function(e){var r,n,i,o,p,g,l,d,s,u,c,m,T,h,x="NK";e=a.getDetachedSpan(e),g=c=e.nextAnyTag("td").tagContents();var v=e.nextAnyTag("tr").allInnerTagsFiltered("td5");d=v[0],p=v[1],l=getFuzzyDate(a.getDetachedSpan(g+" "+p).firstDate());var y=e.nextAnyTag("tr").nextAnyTag("tr").allInnerTagsFiltered("td5");T=y[0],u=y[1],m=getFuzzyDate(a.getDetachedSpan(c+" "+u).firstDate()),n=e.nextAnyTag("tr").nextAnyTag("tr").nextAnyTag("tr").allInnerTagsFiltered("td5")[0],t({airlineName:r,airlineCode:x,flightNumber:n,departureDateTime:l,departureAirport:d,departureAirportCode:s,arrivalDateTime:m,arrivalAirport:T,arrivalAirportCode:h,ticketNumber:i,seatType:o})})};return x(c,function(e){ASSERT(e.flightNumber,e.departureDateTime,e.departureAirport,e.arrivalAirport)&&m.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:e.airlineName,airlineCode:e.airlineCode,flightNumber:e.flightNumber,departureAirportFuzzy:e.departureAirport,departureAirportCode:e.departureAirportCode,departureTime:e.departureDateTime,arrivalAirportFuzzy:e.arrivalAirport,arrivalAirportCode:e.arrivalAirportCode,arrivalTime:e.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:n},checkinUrl:g,reservationId:i,reservationStatus:"http://schema.org/Reservation"+u,totalPrice:o,priceCurrency:p,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:e.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:e.seatNumber,seatingType:e.seatType}}})}),m.length>=1?m:CONTINUE}}).call();