// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("interjet-flight-confirmation-es",function(e){return/^Interjet Itinerario/.test(e.subject)},function(e){if(/^Interjet Itinerario/.test(e.subject)){var r=Scanner.fromMessage(e);r.setLocale("es_MX");var t,a,i,n,s,o,p,l,c,m,d,u,g,h,T,v,f,C,y,b,x,A,I=r.getSpan(),F=[],N={};for(a=I.nextText("C\xf3digo de Confirmaci\xf3n:").parentTag("td3").tagContents().innerCapture(regExpFormatted(/\1(.+)/,"C\xf3digo de Confirmaci\xf3n:"),1).trim(),c=I.nextText("Total MXN:").nextTag("td3").tagContents().innerCapture(/($<priceCurrency>[\W]{1})($<totalPrice>[\d,.]+)/),m=c?c.$totalPrice:null,d=c?c.$priceCurrency:null,s=I.nextText("Informaci\xf3n de pasajeros:").parentTag("table3").allInnerTagsFiltered("tr3"),s.shift(),s.shift(),x=0;x<s.length;x++)n=(""+s[x]).match(/([\w\s]+)\[\/td3\]/)[1],/ADT/.test(n)&&(n=n.replace(/ADT/,"").trim()),N[""+n]={name:n,totalPrice:m,priceCurrency:d,seats:{}};p=I.nextText("Informaci\xf3n de vuelos:").parentTag("table3").allInnerTagsFiltered("tr3");var S=/Clase Tarifa/,j=!1;for(j=!!S.test(p),p.shift(),p.shift(),x=0;x<p.length;x++){g=p[x].innerDate(),f=p[x].lastInnerDate();var k=p[x].allInnerTagsFiltered("td3");l=k[0];var z=1;j===!0&&(z=2),[,T,v]=k[z].innerCapture(/(.+)\s\((.+)\)/),h=k[z+1],[,C,y]=k[z+2].innerCapture(/(.+)\s\((.+)\)/),h=combineDateAndTime(g,h),f=combineDateAndTime(g,f),o="";var D=0;for(b=Object.keys(N),A=0;A<s.length;A++){var P=s[A],R=RegExp(l);R.test(P)&&(o=P.innerCapture(regExpFormatted(/\1\/([\S]+)(\s?)/,R),1).trim(),N[b[D]].seats[""+l]=o,D++)}ASSERT(l,h,f)&&F.push({airlineCode:u,flightNumber:l,departureTime:h,departureCode:v,departureAirport:T.trim(),arrivalTime:f,arrivalCode:y,arrivalAirport:C.trim(),passengers:N})}var E=[];for(x=0;x<F.length;x++){var $=F[x],w=Object.keys($.passengers);for(A=0;A<w.length;A++){b=$.passengers[w[A]];var M={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"InterJet",airlineCode:"4O",flightNumber:$.flightNumber,departureAirportFuzzy:$.departureAirport,departureAirportCode:$.departureCode,departureTime:$.departureTime,arrivalAirportFuzzy:$.arrivalAirport,arrivalAirportCode:$.arrivalCode,arrivalTime:$.arrivalTime},underName:{"@type":"http://schema.org/Person",name:b.name},checkinUrl:i,reservationId:a,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:b.totalPrice,priceCurrency:b.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:t,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:b.seats[""+$.flightNumber],seatingType:""}}};E.push(M)}}if(E.length)return E}},"0/1/2/3/4/5/240/461/462","SGd6d009e5")]);