// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,p,n,o,u,m,c,g,l=[],d=[],s=[];n=a.getSpan().innerCapture(regExpFormatted(/\1 : (.*)/,t.reference),1),o=a.getSpan().innerCapture(regExpFormatted(/\1: ($<totalPrice>[\d\.,]+) ($<priceCurrency>\w{3}) /,t.amount)),o&&(u=o.$totalPrice,m=o.$priceCurrency),i=a.getSpan().allInnerCapture(regExpFormatted(/\1 \d+ : (.+?) - \2 : (\d+)/,t.traveler,t.number));for(var h in i){var v=i[h];g={},g.name=v[1],g.ticketNumber=v[2],d.push(g)}p=a.getSpan().withInterval(a.getSpan().nextText(t.yourTrip).nextText("\n").nextText("\n").getEnd(),a.getSpan().nextText(t.modify).getStart()).trim(),p=p.split("\n");for(var y in p){var z,F=p[y],x={};z=F.innerDate(),x.flightNumber=F.innerCapture(regExpFormatted(/\- \1:.+?(\d+) \-/,t.flight),1).trim(),x.departureTime=getFuzzyDate(a.getDetachedSpan(z+" "+z.nextDate())),x.arrivalTime=getFuzzyDate(a.getDetachedSpan(z+" "+z.nextDate().nextDate())),c=F.innerCapture(regExpFormatted(/\1:\s+($<city>.+?)\s+.+?,\s+($<airport>.+?)[,|\s-]/,t.departure)),x.departureAirportFuzzy=""+c.$city+" "+c.$airport,c=F.innerCapture(regExpFormatted(/\1:\s+($<city>.+?)\s+.+?,\s+($<airport>.+)/,t.arrival)),x.arrivalAirportFuzzy=""+c.$city+" "+c.$airport,ASSERT(x.arrivalAirportFuzzy,x.departureAirportFuzzy,x.flightNumber,x.departureTime,x.arrivalTime)&&l.push(x)}for(var T=0;T<l.length;T++)for(var f=l[T],C=0;C<d.length;C++){g=d[C];var S={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"AirCorsica",airlineCode:"XK",flightNumber:f.flightNumber,departureAirportFuzzy:f.departureAirportFuzzy,departureAirportCode:f.departureAirportCode,departureTime:f.departureTime,arrivalAirportFuzzy:f.arrivalAirportFuzzy,arrivalAirportCode:f.arrivalAirportCode,arrivalTime:f.arrivalTime},underName:{"@type":"http://schema.org/Person",name:g.name},checkinUrl:"",reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:u,priceCurrency:m,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:g.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:""}}};s.push(S)}if(s.length)return s}}).call();