// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,s,l,g,m,u,h,d,c,C,v,T,y,b,f,N,x,A=[],S={};u="Jin Air",m=a.getSpan(),i=m.next(t.reservationId_prefix).nextTag("td3").tagContents(),l=m.next(t.passenger),o=l.nextTag("td4").tagContents().innerCapture(/(.*)\(.*\)/,1),l=m.next(t.flightCurrency).nextTag("td3").tagContents(),l=l.innerCapture(/([,\d]+)(.*)/),null!==l&&(b=l[1],f=l[2]),ASSERT(o)&&(S[""+o]={name:o,seats:{},seatingType:null,ticketNumber:null,totalPrice:b,priceCurrency:f});var z=m.next(t.flightSummary).nextTag("table3");l=z.nextTag("tr3");do N=l.allInnerTags("td3"),g=N[2].tagContents(),[,h,g]=g.innerCapture(/([A-z]+)(\d+)/),x=N[8].tagContents().innerCapture(/(.*)\n(.*)/),d=x[1],[,c,s,d]=d.innerCapture(t.oneFlight),d=s+" "+d,d=getFuzzyDate(a.getDetachedSpan(d).firstDate()),[,T,s,v]=x[2].innerCapture(t.oneFlight),v=s+" "+v,v=getFuzzyDate(a.getDetachedSpan(v).firstDate()),C=null,y=null,ASSERT(g,c,d,T,v)&&A.push({reservationId:i,airlineName:u,airlineCode:h,flightNumber:g,departureAirport:c,departureCode:C,departureTime:d,arrivalAirport:T,arrivalCode:y,arrivalTime:v,passengers:S}),l=l.nextTag("tr3");while(null!==l.nextTag("td3").tagContents().innerCapture(t.flightExit));for(var F=[],k=0;k<A.length;k++)for(var D=A[k],I=Object.keys(D.passengers),P=0;P<I.length;P++){var R=D.passengers[I[P]],E={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:D.airlineName,airlineCode:D.airlineCode,flightNumber:D.flightNumber,departureAirportFuzzy:D.departureAirport,departureAirportCode:D.departureCode,departureTime:D.departureTime,arrivalAirportFuzzy:D.arrivalAirport,arrivalAirportCode:D.arrivalCode,arrivalTime:D.arrivalTime},underName:{"@type":"http://schema.org/Person",name:R.name},checkinUrl:p,reservationId:D.reservationId,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:R.totalPrice,priceCurrency:R.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:n,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:R.seats[D.flightNumber],seatingType:R.seatingType}}};valid(R.membershipNumber,R.programName)&&(E.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:R.membershipNumber,programName:R.programName}),F.push(E)}if(F.length)return F}}).call();