// 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,s,d,u,h,m,c,v,C,D,f,T,z,A,y=[],F=[],S=[],b=a.getSpan();for(m=b.innerCapture(regExpFormatted(/\1:\s*(\w+)/,r.reservationId),1),f=b.next(r.flightsPrefix).nextTag("table2").allInnerTags("tr2"),z=1;z<f.length;z++)T=f[z].allInnerTags("td2"),T&&8!==T.length||(c=T[0].innerCapture(/\s(\d+:\d+)/,1),v=T[1].innerCapture(/\s(\d+:\d+)/,1),l=T[2].innerDate(),o=T[3].innerCapture(/([A-Z]+)(\d+)/),d=T[6].tagContents(),h=T[7].tagContents(),o&&3===o.length&&([,p,g]=o),n=a.getDetachedSpan(""+l+" "+c).innerDate(),i=a.getDetachedSpan(""+l+" "+v).innerDate(),Date.parse(a.getDateDD(i).iso8601)<Date.parse(a.getDateDD(n).iso8601)&&(i=modifyDate(i,1)),ASSERT(p,g,n)&&F.push({airlineCode:p,flightNumber:g,departureAirportCode:s,departureAirportFuzzy:d,arrivalAirportCode:u,arrivalAirportFuzzy:h,departureDateTime:n,arrivalDateTime:i}));for(f=b.next(r.passengersPrefix).nextTag("table2").allInnerTags("tr2"),z=1;z<f.length;z++)T=f[z].allInnerTags("td2"),T&&6!==T.length||(C=T[0].tagContents(),D=T[5].tagContents(),C.getLength()&&y.push({name:C,ticketNumber:D}));for(z=0;z<y.length;z++){var x=y[z];for(A=0;A<F.length;A++){var N=F[A],k={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:N.airlineCode,flightNumber:N.flightNumber,departureAirportFuzzy:N.departureAirportFuzzy,departureAirportCode:N.departureAirportCode,departureTime:N.departureDateTime,arrivalAirportFuzzy:N.arrivalAirportFuzzy,arrivalAirportCode:N.arrivalAirportCode,arrivalTime:N.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:x.name},reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:x.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat"}},reservationStatus:"http://schema.org/ReservationConfirmed",reservationId:m};S.push(k)}}if(S.length)return S}}).call();