// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("hainanairlines-confirmation-1-zh",function(e){return/(?:\u9884\u5b9a\u786e\u8ba4|Booking confirmation)/.test(e.subject)},function(e){if(!/(?:\u9884\u5b9a\u786e\u8ba4|Booking confirmation)/.test(e.subject))return CONTINUE;var t=Scanner.fromMessage(e);t.setLocale("zh_Hans_CN");for(var r=t.getSpan(),a=[],n=r.nextTag("table3").nextTag("tr3").allInnerTagsFiltered("td3")[1].innerCapture(/\n\n(.+)/,1),i=r.allInnerTagsFiltered("td3"),l=i[i.length-2].innerCapture(/(.+) .+\((.+)\)/),s=l[1],o=l[2],p=r.allInnerTags("table2")[5].allInnerTags("table3"),g=p[0].allInnerTagsFiltered("td3")[1].innerCapture(/(20\d{2})/,1),c=0;c<p.length;c++){var h=p[c].innerCapture(/HU(\d{3,4})/);if(h&&2===h.length){var d="HU",m=h[1],u="Hainan Airlines",T=p[c+1].allInnerTagsFiltered("td4"),v=T[0],f=T[1].split(" ")[0],b=T[1].split(", ").pop(),C=T[2].split(" ")[0],y=T[2].split(", ").pop(),F=T[4].innerCapture(/(?:\u8231\u4f4d |Cabin : )(.+)/,1);if(/\u9884\u5b9a\u786e\u8ba4/.test(e.subject)){var I=""+v.innerCapture(/(.+)\u6708/,1),z=(""+v).split(" ")[2],S=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(I)+1;1===(""+S).length&&(S="0"+S),v=g+"-"+S+"-"+z}var x=combineDateAndTime(v,f);x=(""+x).replace(/20\d{2}/,g);var A=combineDateAndTime(v,C);A=(""+A).replace(/20\d{2}/,g);for(var N=r.allInnerTags("table2")[3].allInnerTags("table4"),k=0;k<(N.length-2)/2;k++){var R=2*k,H=N[R].nextTag("tr4").nextTag("td4").tagContents();if(ASSERT(T,H)){var j={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:u,airlineCode:d,flightNumber:m,departureAirportFuzzy:b,departureTime:x,arrivalAirportFuzzy:y,arrivalTime:A},underName:{"@type":"http://schema.org/Person",name:H},reservationId:n,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat",seatingType:F}},totalPrice:s,priceCurrency:o,reservationStatus:"http://schema.org/ReservationConfirmed"};a.push(j)}}}}return a.length?a:void 0},"0/1/2/3/4/5/240/450/451","SG9b556ca1")]);