(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,l,g,p,s,o,m,u,d,h,f,c,T,v,x,b=[],C={},F=loadHelper("united.com-common.js");n=a.getSpan().nextText(r.confirmationNumber).nextTag("td4").nextTag("td4").tagContents(),m=a.getSpan().nextText(r.seatAssignments).parentTag("td3"),g=m.allInnerCapture(regExpFormatted(/\1/,r.dateOfBirth)).filter(function(e){return e.length>0});for(var y={},N=0;N<g.length;N++)l=a.getSpan().innerCapture(regExpFormatted(/\]\s+(.*)\s+\1/,""+g[N][0].parentTag("table4")),1),m=l.nextTag("table4").withEnd(l.nextTag("table4").nextTag("table4").getEnd()),y[""+l]=m;if(a.getSpan().nextText(r.travelerInfo).exists()){g=a.getSpan().nextText(r.travelerInfo).parentTag("td4").allInnerTags("table5");for(var N=0;N<g.length;N++)l=g[N].nextTag("td5").tagContents(),C[l]={name:l,seats:{},seatingType:{}},C[l].seatMap=F.getSeatMap(g[N].nextText(r.seatAssignments).nextTag("td5").tagContents())}else{g=Object.keys(y);for(var N=0;N<g.length;N++){l=g[N],C[l]={name:l,seats:{},seatingType:{}},m=y[l].allInnerTags("table5");for(var S,E,A=0;A<m.length;A++)S=m[A].innerTag("th5").tagContents(),E=m[A].innerTag("td5").tagContents(),S.innerCapture(regExpFormatted(/^\1/,r.knownTravelerNumber))?C[l].ticketNumber=E:S.innerCapture(regExpFormatted(/^\1/,r.frequentFlyer))?(C[l].programName=r.frequentFlyer,C[l].membershipNumber=E):S.innerCapture(regExpFormatted(/^\1/,r.seatAssignments))&&(C[l].seatMap=F.getSeatMap(E))}}if(s=a.getSpan().nextText(r.flightDetails).nextTag("table4").allInnerTags("table5").map(function(e){return e.allInnerTagsFiltered("td5")}).filter(function(e){return e.length>0}),s.length<1){s=a.getSpan().nextText(r.flightDetails).nextTag("table4").allInnerTags("table4").map(function(e){return e.allInnerTagsFiltered("td4")}).filter(function(e){return e.length>0});for(var k=0;k<s.length;k++){p=s[k];for(var z=0;z<p.length;z++){m=p[z],f=getFuzzyDate(a.getDetachedSpan((""+m).replace(/([.,]*)/g,""))),c=m.innerCapture(/\(([A-Z]{3})/,1),T=m.innerCapture(regExpFormatted(/(\1)/,r.arrive),1).nextDate();var D=m.innerCapture(regExpFormatted(/(\1)/,r.arrive),1).nextDate().nextDate();if(T=combineDateAndTime(D,T),v=D.nextRegExp(/([A-Z]{3})/),u=m.innerCapture(regExpFormatted(/\1\s*($<code>\w{2})($<flightNumber>\d+)/,r.flight)),d=u?u.$code:null,o=u?u.$flightNumber:null,x=m.innerCapture(regExpFormatted(/\1\s*(.*)\s+/,r.fareClass),1),valid(o)){g=Object.keys(C);for(var N=0;N<g.length;N++)if(valid(x)&&(C[g[N]].seatingType[""+o]=x.trim()),valid(c,v)){var I=c+" - "+v;C[g[N]].seats[""+o]=C[g[N]].seatMap[I]}}ASSERT(f,c,T,v,d,o)&&b.push({airlineCode:d,flightNumber:o,departureTime:f,departureCode:c,arrivalTime:T,arrivalCode:v,passengers:C}),f=c=T=v=u=d=o=x=null}}}else for(var k=0;k<s.length;k++){p=s[k];for(var z=0;z<p.length;z++)if(m=p[z],m.innerCapture(regExpFormatted(/^\1/,r.depart)))f=getFuzzyDate(a.getDetachedSpan((""+m).replace(/([.,]*)/g,""))),c=m.innerCapture(/\(([A-Z]{3})/,1);else if(m.innerCapture(regExpFormatted(/^\1/,r.arrive)))T=getFuzzyDate(a.getDetachedSpan((""+m).replace(/([.,]*)/g,""))),v=m.innerCapture(/\(([A-Z]{3})/,1);else if(m.innerCapture(regExpFormatted(/^\1/,r.flight))){if(u=m.innerCapture(regExpFormatted(/^\1\s*($<code>\w{2})($<flightNumber>\d+)/,r.flight)),d=u?u.$code:null,o=u?u.$flightNumber:null,x=m.innerCapture(regExpFormatted(/\1\s*(.*)\s+/,r.fareClass),1),valid(o)){g=Object.keys(C);for(var N=0;N<g.length;N++)if(valid(x)&&(C[g[N]].seatingType[""+o]=x.trim()),valid(c,v)){var I=c+" - "+v;C[g[N]].seats[""+o]=C[g[N]].seatMap[I]}}ASSERT(f,c,T,v,d,o)&&b.push({airlineCode:d,flightNumber:o,departureTime:f,departureCode:c,arrivalTime:T,arrivalCode:v,passengers:C}),f=c=T=v=u=d=o=x=null}}for(var M=[],k=0;k<b.length;k++)for(var $=b[k],j=Object.keys($.passengers),O=0;O<j.length;O++){var R=$.passengers[j[O]];h={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:$.airlineCode,flightNumber:$.flightNumber,departureAirportFuzzy:$.departureAirport,departureAirportCode:$.departureCode,departureTime:$.departureTime,arrivalAirportFuzzy:$.arrivalAirport,arrivalAirportCode:$.arrivalCode,arrivalTime:$.arrivalTime},underName:{"@type":"http://schema.org/Person",name:R.name},checkinUrl:i,reservationId:n,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:R.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:R.seats[$.flightNumber],seatingType:R.seatingType[$.flightNumber]}},totalPrice:R.price,priceCurrency:R.currency,reservationStatus:"http://schema.org/ReservationConfirmed"},R.membershipNumber&&(h.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:R.membershipNumber,programName:"Frequent Flyer"}),M.push(h)}if(M.length)return M}}).call();