(function(){return function(e,r,t){if(!e||!r||!t)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,m,s,l,o,u,g,d,c,h,v,x,C,T,N,b,y,f,$,S,F=[],E={};i=a.getSpan().nextRegExp(regExpFormatted(/\1/,t.travellers)).nextAnyTag("table");var D=i.getTagNumber();if(i=i.allInnerTags("tr"+D).map(function(e){return e.allInnerTagsFiltered("td"+D)}),!i.length)return CONTINUE;m=a.getSpan().nextText(t.priceSummary).nextText(t.totalPrice).parentAnyTag("td").tagContents(),s=m.innerCapture(regExpFormatted(/\1.*?([\d,.\s]+)/,t.totalPrice),1),l=m.innerCapture(regExpFormatted(/\1.*?([^\d,.\s]+)/,t.totalPrice),1),o=a.getSpan().innerCapture(regExpFormatted(/\1 (\d+)/,t.reservationId),1),a.getSpan().nextRegExp(regExpFormatted(/\1/,t.cancelled)).exists()?u="Cancelled":a.getSpan().next(t.pending).exists()&&(u="Pending");for(var k=0;k<i.length;k++)p=i[k],n=p[0].innerCapture(/(.*)\s/,1).trim(),C=p[1].innerCapture(regExpFormatted(/^\1/,t.noProgramName))?null:p[1].innerCapture(/($<name>.*) ($<number>\w+)/),p[2]&&(x=p[2].innerCapture(regExpFormatted(/^\1.*?(\d+)/,t.ticketNumber),1)),E[""+n]={name:n,totalPrice:s,priceCurrency:l,seats:{},seatingType:{},programName:C?C.$name:null,membershipNumber:C?C.$number:null,ticketNumber:x};v=a.getSpan().nextRegExp(regExpFormatted(/\1/,t.travellers));for(var A=/^($<code>[A-Z]{3})\s+($<time>\d{1,2}(?::|\sh\s)\d{2}\s?(?:am|pm)?)($<nextDay>\s+\+[12])?/;v.nextText(t.totalTravelTime).exists();){v=v.nextText(t.totalTravelTime),c=a.getDetachedSpan((""+v.previousTag("td"+(D-1)).tagContents()).replace(",","")).innerDate(),v=v.nextTag("table"+D),h=v.allInnerTagsFiltered("td"+D);for(var I,P,z,R=0;I=h[R];R++)if(I.innerCapture(A)&&h[R+1]&&h[R+1].innerCapture(A)&&h[R+3]){I=I.innerCapture(A),f=I.$code,y=a.getDetachedSpan(c+" "+I.$time.trim()).innerDate(),P=h[R+1].innerCapture(A),z=P.$nextDay,S=P.$code,$=a.getDetachedSpan(((""+z).length?""+h[R+1].lastInnerDate():""+c)+" "+P.$time.trim()),h[R+1].nextText(t.checkin).exists()&&R++,/\d+/.test(""+h[R+2])||R++,T=h[R+2].innerCapture(/($<name>.*)\s($<flightNumber>\d+)/),N=T?T.$name.trim():null,b=T?T.$flightNumber:null,g=h[R+3].innerCapture(/($<type>.*?) \| ($<list>[^|]+)/);var U=g?g.$type:null;if(d=g&&g.$list.innerCapture(regExpFormatted(/^\1/,t.seat))?g.$list.innerCapture(regExpFormatted(/^\1 (.*)/,t.seat),1).split(",").map(function(e){return e.trim()}):null,valid(b)){i=Object.keys(E);for(var k=0;k<i.length;k++)valid(d)&&(E[i[k]].seats[""+b]=d[k]),valid(U)&&(E[i[k]].seatingType[""+b]=U)}Date.parse(unSpanDate_(y))>Date.parse(unSpanDate_($))&&($=modifyDate($,1)),ASSERT(N,b,f,y,S,$)&&F.push({airlineName:N,flightNumber:b,reservationId:o,reservationStatus:u,departureCode:f,departureTime:y,arrivalCode:S,arrivalTime:$,passengers:E})}}for(var O,M=[],R=0;R<F.length;R++){O=F[R];for(var j=Object.keys(O.passengers),_=0;_<j.length;_++){var w=O.passengers[j[_]],L={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:O.airlineName,airlineCode:O.airlineCode,flightNumber:O.flightNumber,departureAirportFuzzy:O.departureAirport,departureAirportCode:O.departureCode,departureTime:O.departureTime,arrivalAirportFuzzy:O.arrivalAirport,arrivalAirportCode:O.arrivalCode,arrivalTime:O.arrivalTime},underName:{"@type":"http://schema.org/Person",name:w.name},checkinUrl:O.checkinUrl,reservationId:O.reservationId,reservationStatus:"http://schema.org/Reservation"+(O.reservationStatus||"Confirmed"),totalPrice:w.totalPrice.trim(),priceCurrency:w.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:w.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:w.seats[O.flightNumber],seatingType:w.seatingType[O.flightNumber]}}};valid(w.membershipNumber,w.programName)&&(L.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:w.membershipNumber,programName:w.programName}),M.push(L)}}return M.length?M:void 0}}).call();