// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e),i=a.getSpan();a.setLocale(t);var n,p,l,o,s,g,c,m,x,d,T;m=(""+i.nextText(r.passengerDetailsHeader).nextTag("table1").nextTag("tr1").nextTag("tr1").allInnerTagsFiltered("td1")).split(","),n=m[2]+" "+m[3],void 0!==m[2]&&void 0!==m[3]||(n=""),o=m[5];var u=a.getSpan().nextText(r.itineraryPrefix).withEnd(a.getSpan().nextText(r.itineraryPostfix).getStart()),h=[];h=u.allInnerTagsFiltered("table1");for(var v=[],f=0;f<h.length;f++){var y,C,P,S,D,z;d=(""+h[f].innerText(r.departureairportPrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),T=(""+h[f].nextText(r.arrivalairportPrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),y=(""+h[f].nextText(r.departuredatePrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),/([0-9])+\s(\D)/.test(y)&&(y=y.match(/(.+)\s/)[1].trim(),y=y.replace(/-/g," ")),S=(""+h[f].innerText(r.arrivaldatePrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),/([0-9])+\s(\D)/.test(S)&&(S=S.match(/(.+)\s/)[1].trim(),S=S.replace(/-/g," ")),x=(""+h[f].innerText(r.airlinePrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),o=(""+h[f].innerText(r.ticketPrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),C=(""+h[f].innerText(r.departuretimePrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),C=C.slice(0,2)+":"+C.slice(2,4),D=(""+h[f].innerText(r.arrivaltimePrefix).nextTag("td1").tagContents()).replace(/:/,"").trim(),D=D.slice(0,2)+":"+D.slice(2,4),P=getFuzzyDate(a.getDetachedSpan(""+y+" "+C)),z=getFuzzyDate(a.getDetachedSpan(""+S+" "+D)),ASSERT(d,T,C,D)&&v.push({departureAirport:d,arrivalAirport:T,airlineName:x,ticketNumber:o,departureDateTime:P,arrivalDateTime:z})}var F=[];for(f=0;f<v.length;f++){var A=v[f],N={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:A.airlineName,airlineCode:"",flightNumber:"",departureAirportFuzzy:A.departureAirport,departureAirportCode:"",departureTime:A.departureDateTime,arrivalAirportFuzzy:A.arrivalAirport,arrivalAirportCode:"",arrivalTime:A.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:n},checkinUrl:s,reservationId:"",reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:p,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:o,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:g,seatingType:c}}};F.push(N)}return F}}).call();