// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){function a(){ASSERT(f.airlineCode,f.flightNumber,f.departureDate,f.arrivalDate,f.departureAirport,f.arrivalAirport)&&(C.push(f),f={})}function n(e){return(""+e.trim()).replace(/\n/g," ").replace(/\s+/g," ")}e.plain=e.plain.replace(RegExp(String.fromCharCode("0x200b"),"g"),"");var i=Scanner.fromMessage(e);i.setLocale(t);var g,o,p,l,s,d,m,u,x,h,C=[],T=i.getSpan().nextText(r.reservationCodePrefix).parentTag("td2").tagContents().innerCapture(regExpFormatted(/\1\n(\w+)/,r.reservationCodePrefix),1).trim(),c=i.getSpan().next(r.passengerNamePrefix).nextTag("td5").tagContents().trim(),v=i.getSpan().nextText(r.ticketNumberPrefix).nextTag("td5").tagContents().innerCapture(/(.*)</,1).trim();g=i.getSpan().next(r.passengerNamePrefix).withEnd(i.getSpan().next(r.baggageRegulations).getStart()).allInnerTags("table1");for(var f={},N=0;N<g.length;N++){var S=g[N];p=S.innerText(r.reservationColumnHeader).nextTag("td1"),o=p.nextTag("td1").tagContents().innerCapture(regExpFormatted(/($<airlineCode>\w{2}) ($<flightNumber>\d+)\n\1\n($<airlineName>.+)/,r.operatedByPrefix)),f.airlineCode=o.$airlineCode.trim(),f.flightNumber=o.$flightNumber.trim(),f.airlineName=o.$airlineName.trim(),d=p.nextTag("td1").nextTag("td1").tagContents().allDates(),l=d[0],0===d.length?(l=p.nextTag("td1").nextTag("td1").tagContents(),s=l):s=d.length>1?d[1]:d[0],x=p.nextTag("td1").nextTag("td1").nextTag("td1").tagContents(),h=x.nextTag("td1").tagContents(),m=h.nextTag("td1").tagContents(),u=m.nextTag("td1").tagContents(),f.seatingType=u.nextTag("td1").tagContents().innerCapture(/(.*)/,1),f.seatNumber=""+u.nextTag("td1").tagContents().innerCapture(regExpFormatted(/\1:(.*)/,r.seatPrefix),1).trim(),f.departureDate=i.getDetachedSpan((""+l).replace(".","")+" "+m).innerDate(),f.arrivalDate=i.getDetachedSpan((""+s).replace(".","")+" "+u).innerDate(),f.departureAirport=n(x),f.arrivalAirport=n(h),a()}for(var b=[],y=0;y<C.length;y++){var D=C[y];b.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:D.airlineName,airlineCode:D.airlineCode,flightNumber:D.flightNumber,departureAirportFuzzy:D.departureAirport,departureTime:D.departureDate,arrivalAirportFuzzy:D.arrivalAirport,arrivalTime:D.arrivalDate},underName:{"@type":"http://schema.org/Person",name:c},reservationId:T,reservationStatus:"http://schema.org/ReservationConfirmed",reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:v,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:D.seatNumber,seatingType:D.seatingType}}})}return b}}).call();