// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,d,g,l,u,s,m,c,T,h,y,A,C,v=[],$=[];for(n=a.getSpan().next(t.reservationId).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.reservationId),1),m=a.getSpan().next(t.checkInUrl).nextLink(),i=a.getSpan().next(t.itinerary).parentTag("table3").allInnerTransitInformation(),h=a.getSpan().withStart(a.getSpan().next(t.passengerInfo)).withEnd(a.getSpan().next(t.price)).allInnerCapture(t.frequentFlyer,1),p=0;p<h.length;p++){for(T={},T.name=h[p].previousAnyTag("td").previousAnyTag("td").tagContents(),T.seat={},T.seatingType={},A=h[p].nextAnyTag("table").allInnerTagsFiltered("tr6"),y=0;y<A.length;y++)C=""+A[y].innerCapture(/(\d+)\s*\[/,1),T.seat[C]=A[y].nextAnyTag("td").nextAnyTag("td").tagContents(),T.seatingType[C]=T.seat[C].nextAnyTag("td").tagContents();$.push(T)}for(l=a.getSpan().next(t.price).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1.*=\s+($<currency>[^\d,.]+)($<price>[\d,.]+)/,t.price)),u=l.$price,s=l.$currency,p=0;p<i.length;p++)o={},d=i[p].previousAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<departureAirport>.*)\(($<departureCode>.*)\)\s\1\s+($<arrivalAirport>.*)\(($<arrivalCode>.*)\).*\n($<date>.*).*\n($<departureTime>.*\D{2})($<arrivalTime>.*\D{2})\s+/,t.to)),o.departureAirportFuzzy=d.$departureAirport.trim(),o.departureAirportCode=d.$departureCode,o.arrivalAirportFuzzy=d.$arrivalAirport.trim(),o.arrivalAirportCode=d.$arrivalCode,o.departureTime=combineDateAndTime(d.$date.innerDate(),a.getDetachedSpan((""+d.$departureTime).replace(/\x96/,"")).innerDate()),o.arrivalTime=combineDateAndTime(d.$date.innerDate(),a.getDetachedSpan((""+d.$arrivalTime).replace(/\x96/,"")).innerDate()),o.seatingType=i[p].nextAnyTag("td").tagContents().innerCapture(/\n(.*)/,1),g=i[p].innerCapture(/($<airlineCode>\D+)($<flightNumber>\d+)/),o.airlineCode=g.$airlineCode.trim(),o.flightNumber=g.$flightNumber,ASSERT(o.departureAirportCode,o.arrivalAirportCode,o.departureTime,o.arrivalTime,o.airlineCode,o.flightNumber)&&v.push(o);c=a.getSpan().next(t.ticketNumber).nextAnyTag("tr").nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").tagContents();var x=[];for(p=0;p<v.length;p++)for(o=v[p],y=0;y<$.length;y++){T=$[y];var f={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:o.airlineName,airlineCode:o.airlineCode,flightNumber:o.flightNumber,departureAirportFuzzy:o.departureAirportFuzzy,departureAirportCode:o.departureAirportCode,departureTime:o.departureTime,arrivalAirportFuzzy:o.arrivalAirportFuzzy,arrivalAirportCode:o.arrivalAirportCode,arrivalTime:o.arrivalTime},underName:{"@type":"http://schema.org/Person",name:T.name},checkinUrl:m,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:u,priceCurrency:s,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:c,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:T.seat[""+o.flightNumber],seatingType:T.seatingType[""+o.flightNumber]}}};x.push(f)}if(x.length)return x}}).call();