// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){function a(){ASSERT(h.airlineName,h.flightNumber,h.departureAirportCode,h.departureDateTime,h.arrivalAirportCode,h.arrivalDateTime)&&C.push(h)}var n=Scanner.fromMessage(e);n.setLocale(t);var i=n.getSpan().next(r.passengerNamePrefix).parentTag("table3"),g=i.nextText(r.passengerNamePrefix).nextTag("tr3").nextTag("td3").tagContents().trim(),p=n.getSpan().tagContents().innerCapture(regExpFormatted(/\1 ([0-9]+)/),1).trim(),o=i.nextText(r.ticketNumberPrefix).nextTag("tr3").nextTag("td3").nextTag("td3").tagContents().trim(),m=i.nextText(r.frequentFlyerPrefix).nextTag("tr3").nextTag("td3").nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/(.*) \|/),1).trim(),d=n.getSpan().next(r.pricePrefix).nextTag("td3").tagContents(),x=d.innerCapture(/([0-9,\.]+)/,1).trim(),u=d.innerCapture(/(\D)[0-9]+/,1).trim();u||(u=d.innerCapture(/[0-9]+(\D)/,1).trim());for(var T,s=n.getSpan().next(r.tripSummaryHeader).parentTag("table2").allInnerTags("table3"),l=s.filter(function(e){return(""+e.tagContents()).length}),C=[],h={},c=0;c<l.length;c++)h={},T=l[c],/Flight/.test(T)&&T.innerText(r.flightSummaryHeader).exists()&&(h.flightNumber=T.nextTag("td3").tagContents().innerCapture(regExpFormatted(/\1 ([0-9]+)/,r.flightNumberPrefix),1).trim(),h.departureAirportCode=T.nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/\(([A-Z]{3})\)/),1).trim(),h.departureDateTime=T.nextTag("td3").nextTag("td3").tagContents().innerDate(),h.departureAirportName=T.nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/\1 (.*)\(/,r.fromPrefix),1).trim(),h.arrivalAirportCode=T.nextTag("td3").nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/\(([A-Z]{3})\)/),1).trim(),h.arrivalDateTime=T.nextTag("td3").nextTag("td3").nextTag("td3").tagContents().innerDate(),h.arrivalAirportName=T.nextTag("td3").nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/\1 (.*)\(/,r.toPrefix),1).trim(),h.airlineName=T.nextTag("td3").nextTag("td3").nextTag("td3").nextTag("td3").nextTag("td3").tagContents().innerCapture(regExpFormatted(/(.*)/),1).trim(),a());for(var f=[],v=0;v<C.length;v++){var N=C[v];f.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:N.airlineName,airlineCode:N.airlineCode,flightNumber:N.flightNumber,departureAirportFuzzy:N.departureAirportName,departureAirportCode:N.departureAirportCode,departureTime:N.departureDateTime,arrivalAirportFuzzy:N.arrivalAirportName,arrivalAirportCode:N.arrivalAirportCode,arrivalTime:N.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:g},programMembershipUsed:{"@type":"http://schema.org/ProgramMembership",membershipNumber:m,programName:"Frequent Flyer"},reservationId:p,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:x,priceCurrency:u,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:o,ticketedSeat:{"@type":"http://schema.org/Seat"}}})}return f}}).call();