// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("usairways.com-receipt-en",function(e){return/^Your US Airways receipt:/.test(e.subject)},function(e){if(/^Your US Airways receipt:/.test(e.subject)){var r=Scanner.fromMessage(e);r.setLocale("en_US");var a,t,i,n,p,l,m,s,u,o,g,c,d,h,v,b=[],N={};a=r.getSpan().innerCapture(/\bConfirmation Code: (\w+)/,1),i=r.getSpan().nextText("Passenger Name").parentTag("table3").allInnerTags("tr3").map(function(e){return e.allInnerTagsFiltered("td3")});for(var T=1;T<i.length&&(u=i[T],!(u.length<7));T++)s=u[6].innerCapture(/($<price>[\d,.]+) ($<currency>[A-Z]{3})/),N[""+u[0]]={name:u[0],membershipNumber:""+u[2]!="NA"&&u[2],programName:"Frequent Flyer",ticketNumber:u[3],totalPrice:s?s.$price:null,priceCurrency:s?s.$currency:null,seats:{},seatingType:{}};l=r.getSpan().nextText("Flight Itinerary").parentTag("table3").allInnerTags("tr3").map(function(e){return e.allInnerTagsFiltered("td3")});for(var y=1;y<l.length;y++){u=l[y],o=u[0].innerCapture(/($<name>.*?) ($<flightNumber>\d+)/),g=o?o.$name:null,m=o?o.$flightNumber:null,p=u[1].innerCapture(concatRegExp(/\bDepart: ($<departureTime>\d{1,2}:\d{2} [A|P]M) .*? \(($<departureCode>[A-Z]{3})\)\s+/,/\bArrival: ($<arrivalTime>\d{1,2}:\d{2} [A|P]M) .*? \(($<arrivalCode>[A-Z]{3})\)/)),d=p?p.$departureCode:null,v=p?p.$arrivalCode:null,c=p?p.$departureTime:r.getNullSpan(),h=p?p.$arrivalTime:r.getNullSpan(),c=r.getDetachedSpan(""+u[2]+" "+c).innerDate(),h=r.getDetachedSpan(""+u[2]+" "+h).innerDate();var f=u[5];if(n=u[6],valid(m)&&(valid(n)||valid(f))){i=Object.keys(N);for(var T=0;T<i.length;T++)N[i[T]].seats[m]=n,N[i[T]].seatingType[m]=f}ASSERT(g,m,d,c,v,h)&&b.push({airlineName:g,flightNumber:m,departureCode:d,departureTime:c,arrivalCode:v,arrivalTime:h,passengers:N})}for(var C=[],y=0;y<b.length;y++)for(var S=b[y],A=Object.keys(S.passengers),$=0;$<A.length;$++){var F=S.passengers[A[$]],k={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:S.airlineName,airlineCode:S.airlineCode||"US",flightNumber:S.flightNumber,departureAirportFuzzy:S.departureAirport,departureAirportCode:S.departureCode,departureTime:S.departureTime,arrivalAirportFuzzy:S.arrivalAirport,arrivalAirportCode:S.arrivalCode,arrivalTime:S.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name,email:F.email},checkinUrl:t,reservationId:a,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:F.totalPrice,priceCurrency:F.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:F.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:F.seats[S.flightNumber],seatingType:F.seatingType[S.flightNumber]}}};valid(F.membershipNumber,F.programName)&&(k.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:F.membershipNumber,programName:F.programName}),C.push(k)}if(C.length)return C}},"0/1/2/3/4/5/240/617/622","SGeba5eefb")]);