// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,a){function t(r){if(r.test(e.plain)){var a=RegExp(/From\s+($<departureFuzzy>.*)\(($<departureCode>.+?)\)\s+/.source+/to\s+($<arrivalFuzzy>.*)\(($<arrivalCode>.+?)\)\n/.source+/($<date>.+)\s+Flight\s+($<flightNumber>\d+)\s+Depart.+?at\s+/.source+/($<departureHour>[\d]{2})($<departureMinute>[\d]{2})\s+/.source+/and arrive.*at\s+($<arrivalHour>[\d]{2})($<arrivalMinute>[\d]{2})/.source);s=i.getSpan().innerCapture(regExpFormatted(/\1\n+\2/,r,a)),c=s.$departureFuzzy,m=s.$departureCode,$=s.$arrivalFuzzy,C=s.$arrivalCode,l="FR",o=s.$flightNumber,g=i.getDetachedSpan(s.$date+" "+s.$departureHour+":"+s.$departureMinute).innerDate(),h=i.getDetachedSpan(s.$date+" "+s.$arrivalHour+":"+s.$arrivalMinute).innerDate(),ASSERT(o,g,c,h,$)&&N.push({airlineCode:l,flightNumber:o,departureAirport:c,departureCode:m,departureTime:g,arrivalAirport:$,arrivalCode:C,arrivalTime:h,passengers:T})}}var i=Scanner.fromMessage(e);i.setLocale(r);var n,p,o,u,d,s,l,g,c,m,v,h,$,C,F,f,y,z,S=[],N=[];F=i.getSpan().innerCapture(regExpFormatted(/\1\s+(.*)/,a.reservationId),1);var T=i.getSpan().innerCapture(regExpFormatted(/\1\n(.*)/,a.passengers),1).allInnerCapture(/\d\.\s+([\D]+)/,1);if(!T||!T.length){var A=i.getSpan().innerCapture(regExpFormatted(/\1\s+(.+)/,a.passengers),1).rstrip(":");T=[A]}for(t(a.goingOut),t(a.comingBack),f=0;f<N.length;f++){v=N[f];for(var b=0;b<T.length;b++){var k={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:v.airlineName,airlineCode:v.airlineCode,flightNumber:v.flightNumber,departureAirportFuzzy:v.departureAirport,departureAirportCode:v.departureCode,departureTime:v.departureTime,arrivalAirportFuzzy:v.arrivalAirport,arrivalAirportCode:v.arrivalCode,arrivalTime:v.arrivalTime},underName:{"@type":"http://schema.org/Person",name:T[b]},checkinUrl:y,reservationId:F,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:u,priceCurrency:d,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:z,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:n,seatingType:p}}};S.push(k)}}if(S.length)return S}}).call();