// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("kenya-reservation-en",function(e){return/^Confirmation for Reservation/.test(e.subject)||/^Cancellation of reservation/.test(e.subject)},function(e){if(/^Confirmation for Reservation/.test(e.subject)||/^Cancellation of reservation/.test(e.subject)){var t=Scanner.fromMessage(e);t.setLocale("en_US");var r,a=t.getSpan(),n=!1;/Confirmation/.test(e.subject)?r="Confirmed":(r="Cancelled",n=!0);var i,o,l,s,p,c,u,d,g,m,v,h,T,C,f,x,b,y,A,F,k,S,I=[],N={};for(o=a.nextText("Booking reservation number:").parentTag("td2").tagContents().innerCapture(regExpFormatted(/\1(.+)/,"Booking reservation number:"),1).trim(),d=n===!0?a.nextText("amount to be refunded").nextTag("td4").tagContents().innerCapture(/($<totalPrice>[\d,.]+)\s($<priceCurrency>[\w]+)/):a.nextText("Flight payment and ticket").nextTag("table3").nextTag("td3").tagContents().innerCapture(/($<totalPrice>[\d,.]+)\s($<priceCurrency>[\w]+)/),g=d?d.$totalPrice:null,m=d?d.$priceCurrency:null,p=a.withInterval(a.nextText("Traveller information").getEnd(),a.nextText("Contact Information").getStart()).allInnerTagsFiltered("td2"),k=0;k<p.length;k++)s=""+p[k],N[""+s]={name:s,totalPrice:g,priceCurrency:m};for(c=n===!0?a.withInterval(a.nextText("your flight selection").getEnd(),a.nextText("amount to be refunded").getStart()).allInnerTagsFiltered("table2"):a.withInterval(a.nextText("your flight selection").getEnd(),a.nextText("Flight payment and ticket").getStart()).allInnerTagsFiltered("table2"),k=0;k<c.length;k++)if(!/Your e-ticket and flight payment have been processed./.test(c[k])){T=c[k].innerDate(),[,v,h,u]=c[k].nextText("Airline").nextTag("td3").tagContents().innerCapture(/(.+)\s([A-Z0-9]{2})\s(\d+)/);var w=c[k].nextTag("table4").allInnerTagsFiltered("td4");C=w[1],[,f]=w[2].innerCapture(/(.+),/),b=w[4],[,y]=w[5].innerCapture(/(.+),/),A=w[5],C=combineDateAndTime(T,C),b=combineDateAndTime(T,b),ASSERT(u,C,b)&&I.push({airlineName:v,airlineCode:h,flightNumber:u,departureTime:C,departureCode:x,departureAirport:f.trim(),arrivalTime:b,arrivalCode:A,arrivalAirport:y.trim(),passengers:N})}var P=[];for(k=0;k<I.length;k++){var R=I[k],j=Object.keys(R.passengers);for(S=0;S<j.length;S++){F=R.passengers[j[S]];var z={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:R.airlineName,airlineCode:R.airlineCode,flightNumber:R.flightNumber,departureAirportFuzzy:R.departureAirport,departureAirportCode:R.departureCode,departureTime:R.departureTime,arrivalAirportFuzzy:R.arrivalAirport,arrivalAirportCode:R.arrivalCode,arrivalTime:R.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name},checkinUrl:l,reservationId:o,reservationStatus:"http://schema.org/Reservation"+r,totalPrice:F.totalPrice,priceCurrency:F.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:i,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:""}}};P.push(z)}}if(P.length)return P}},"0/1/2/3/4/5/240/484/485","SG38f83958")]);