// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,p,o,u,g,l,m,s,d=[],h=[],c=[];p=a.getSpan().innerCapture(regExpFormatted(/\1\s*: (.*)/,t.reference),1).trim(),l=a.getSpan().nextText(t.number).parentTag("td1").tagContents().innerCapture(regExpFormatted(/\1(.*)/,t.number),1).trim(),o=a.getSpan().nextText(t.total).nextAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<totalPrice>[\d\.,]+)\s+($<priceCurrency>\w{3})/)),o&&(u=o.$totalPrice,g=o.$priceCurrency),i=a.getSpan().nextText(t.passenger).nextTag("tr1").nextTag("tr1").innerTag("td1").nextTag("td1").tagContents().innerCapture(regExpFormatted(/(.*)\s.*$/,t.passenger),1).trim(),h.push({name:i}),n=a.getSpan().firstTag("table1").allInnerTagsFiltered("tr1");for(var T=4;T<n.length;T+=4){s={};var v,C,x=n[T];C=x.innerDate(),C.exists()&&/^\d+/.test(x)&&(C=C.split("-"),v=x.previousText(t.return),v.exists()||(v=x.previousText(t.airfare)),v=v.nextDate(),m=n[T+1].withEnd(n[T+1].nextClosingTag("td1").getStart()).innerCapture(/($<airlineCode>\D+)($<flightNumber>\d+)/),s.flightNumber=m.$flightNumber,s.airlineCode=m.$airlineCode,s.departureTime=getFuzzyDate(a.getDetachedSpan(v+" "+C[0])),s.arrivalTime=getFuzzyDate(a.getDetachedSpan(v+" "+C[1])),s.departureAirportFuzzy=x.innerCapture(/\[td1\](.*)\-/,1).trim(),s.arrivalAirportFuzzy=x.innerCapture(/\[td1\].*\-(.*)/,1).trim(),s.airlineName=n[T+1].innerCapture(regExpFormatted(/\1\s*:(.*)\|/,t.operate),1).trim(),ASSERT(s.flightNumber,s.departureTime,s.arrivalTime,s.departureAirportFuzzy,s.arrivalAirportFuzzy)&&d.push(s))}for(var z=0;z<d.length;z++){s=d[z];for(var y=0;y<h.length;y++){var F=h[y],f={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:s.airlineName,airlineCode:s.airlineCode,flightNumber:s.flightNumber,departureAirportFuzzy:s.departureAirportFuzzy,departureAirportCode:s.departureAirportCode,departureTime:s.departureTime,arrivalAirportFuzzy:s.arrivalAirportFuzzy,arrivalAirportCode:s.arrivalAirportCode,arrivalTime:s.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name},checkinUrl:"",reservationId:p,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:u,priceCurrency:g,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:l,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:""}}};c.push(f)}}if(c.length)return c}}).call();