// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,o,p,l,g,s,u,m,h,c,d,C,T=[],v=[],f=[];for(n=a.getSpan().innerCapture(regExpFormatted(/\1\s+(.*)/,r.reservationId),1),o=a.getSpan().next(r.priceInfo).next(r.totalPrice).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,r.totalPrice),1),p=o.innerCapture(/([\d,.]+)/,1),l=o.innerCapture(/([^\d,.]+)/,1),u=a.getSpan().next(r.bookingDetails).nextTag("table2").allInnerTags("tr2"),s=2;s<u.length;s++)m={},C=u[s].allInnerTags("td2"),m.name=""+C[1].tagContents()+" "+C[2].tagContents(),m.ticketNumber=C[3].tagContents(),ASSERT(m.name)&&T.push(m);for(c=a.getSpan().next(r.flightDetails).nextTag("table2").allInnerTags("tr2"),s=1;s<c.length;s+=2)h={},d=c[s].allInnerTags("td2"),i=d[0].tagContents().innerCapture(/($<airlineCode>\D{2})($<flightNumber>\d+)/),h.airlineCode=i.$airlineCode,h.flightNumber=i.$flightNumber,h.departureAirport=d[2].tagContents(),h.arrivalAirport=d[3].tagContents(),h.departureTime=a.getDetachedSpan((""+d[4].tagContents()).replace(/[,\.]/,"")).innerDate(),h.arrivalTime=a.getDetachedSpan((""+d[5].tagContents()).replace(/[,\.]/,"")).innerDate(),h.seatingType=d[6].tagContents(),ASSERT(h.airlineCode,h.flightNumber,h.departureAirport,h.arrivalAirport,h.departureTime,h.arrivalTime)&&v.push(h);for(s=0;s<v.length;s++){h=v[s];for(var S=0;S<T.length;S++){m=T[S];var b={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"TAP Portugal",airlineCode:h.airlineCode,flightNumber:h.flightNumber,departureAirportFuzzy:h.departureAirport,departureTime:h.departureTime,arrivalAirportFuzzy:h.arrivalAirport,arrivalTime:h.arrivalTime},underName:{"@type":"http://schema.org/Person",name:m.name},checkinUrl:g,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:p,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:m.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:h.seatingType}}};f.push(b)}}if(f.length)return f}}).call();