// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,o,p,s,l,m,u,c,g,d=a.getSpan();i=d.innerCapture(regExpFormatted(/\1 (.*)/,t.underPersonName_prefix),1),n=d.innerCapture(regExpFormatted(/\1 (.*)/,t.underPersonEmail_prefix),1),o=d.innerCapture(regExpFormatted(/\1 (.*)/,t.underPersonPhone_prefix),1),p=d.innerCapture(regExpFormatted(/\1 (.*)/,t.reservationId_prefix),1);var h=""+d.nextText(t.totalPrice_prefix).nextTag("td4").tagContents();s=h.substring(1),l=h[0],u=c=g=d.nextText(t.checkinUrl_prefix).nextLink();var v=(""+d.nextText(t.isHotelEmail)).length>0;if(!v){var x=[],f=[];x=d.nextText(t.reservationForBlock_prefix).nextTag("table4").allInnerTags("tr4");var C=d.innerCapture(regExpFormatted(/\1 (.*) [0-9] P\./,t.airportCode_prefix),1).split(" - "),T=function(e,r){e.forEach(function(e,t){var i=e.allInnerTags("td4");if(1===i.length&&0!==(""+i[0].tagContents()).length){e=i[0];var n,o,p,s,l,m,u,c,g,d,h,v=(""+e.tagContents()).split("\n");n=l=v[0].trim(),o=v[3].split("-")[0].trim(),m=v[3].split("-")[1].trim(),p=n+", "+o,p=getFuzzyDate(a.getDetachedSpan(p).firstDate()),u=l+", "+m,u=getFuzzyDate(a.getDetachedSpan(u).firstDate()),s=v[4].split("-")[0].trim(),c=v[4].split("-")[1].trim(),[,g,d,h]=/^([a-zA-Z0-9]+) ([a-zA-Z0-9]+) (.*)/.exec(v[2]),r({airlineName:h,airlineCode:g,flightNumber:d,departureDateTime:p,departureAirport:s,departureAirportCode:(""+C[t/2]).toUpperCase(),arrivalDateTime:u,arrivalAirport:c,arrivalAirportCode:(""+C[t/2+1]).toUpperCase()})}})};return T(x,function(e){ASSERT(e.flightNumber,e.departureAirport,e.arrivalAirport)&&f.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:e.airlineName,airlineCode:e.airlineCode,flightNumber:e.flightNumber,departureAirportFuzzy:e.departureAirport,departureAirportCode:e.departureAirportCode,departureTime:e.departureDateTime,arrivalAirportFuzzy:e.arrivalAirport,arrivalAirportCode:e.arrivalAirportCode,arrivalTime:e.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:i},checkinUrl:u,reservationId:p,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:s,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:m,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:e.seatNumber,seatingType:e.seatType}}})}),f.length>=1?f:CONTINUE}var y,A,F,N,z,E,S="Confirmed";if([,F,y,A,E]=d.nextText(t.reservationForBlock_prefix).nextTag("table4").nextTag("td4").tagContents().innerCapture(regExpFormatted(/(.*)\n\n(.*)\n(.*)\n(.*)/)),ASSERT(y,A,F))return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:i,email:n},totalPrice:s,priceCurrency:l,checkinTime:y,checkoutTime:A,modifyReservationUrl:c,cancelReservationUrl:g,reservationStatus:"http://schema.org/Reservation"+S,reservationId:p,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:F,url:N,telephone:z,address:E}}]}}).call();