// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("alaskaair.com-trip-reminder-en",function(e){return/^Need Anything for Your Trip to/.test(e.subject)},function(e){if(int(e.epoch)<1356998400)return CONTINUE;var r=Scanner.fromMessage(e);r.setLocale("en_US");var t,a,i,n,o,p,s,m,u,l,g,h,c,d,v=[],N={};if(/^Need Anything for Your Trip to/.test(e.subject)){if(o=r.getSpan().innerCapture(/How Can We Help You, (.*)\?/,1),not(o))return CONTINUE;N[""+o]={name:o,seats:{},seatingType:{}},t=r.getSpan().nextText("Your confirmation code is").nextTag("td7").tagContents(),p=r.getSpan().nextText("Trip Details").nextTag("table3").allInnerTags("table8").map(function(e){return e.allInnerTagsFiltered("td8")}).filter(function(e){return e.length>0});var T=/($<name>.*) ($<flightNumber>\d+)$/,b=/.*\(([A-Z]{3})\)/;for(d=0;d<p.length;d++)n=p[d],n[0].innerCapture(T)?(m=n[0].innerCapture(T),u=m.$name,s=m.$flightNumber):n[0].innerCapture(b)&&(not(g)?(g=n[0].innerCapture(b,1),l=getFuzzyDate(n[0])):(c=n[0].innerCapture(b,1),h=getFuzzyDate(n[0]),ASSERT(u,s,g,l,c,h)&&v.push({airlineName:u,flightNumber:s,departureCode:g,departureTime:l,arrivalCode:c,arrivalTime:h,passengers:N}),m=u=s=g=l=c=h=null))}var f=[];for(d=0;d<v.length;d++)for(var C=v[d],y=Object.keys(C.passengers),S=0;S<y.length;S++){var A=C.passengers[y[S]];/alaska/i.test(C.airlineName)&&(C.airlineCode="AS"),i={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:C.airlineName,airlineCode:C.airlineCode,flightNumber:C.flightNumber,departureAirportFuzzy:C.departureAirport,departureAirportCode:C.departureCode,departureTime:C.departureTime,arrivalAirportFuzzy:C.arrivalAirport,arrivalAirportCode:C.arrivalCode,arrivalTime:C.arrivalTime},underName:{"@type":"http://schema.org/Person",name:A.name},checkinUrl:a,reservationStatus:"http://schema.org/Reservation"+(C.reservationStatus||"Confirmed"),reservationId:valid(C.reservationId)?C.reservationId:t,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:A.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:A.seats[C.flightNumber],seatingType:A.seatingType[C.flightNumber]}},totalPrice:A.totalPrice,priceCurrency:A.priceCurrency},not(A.membershipNumber)||(i.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:A.membershipNumber,programName:A.programName}),f.push(i)}return f.length?f:void 0},"0/1/2/3/4/5/240/333/337","SG7cd17764")]);