(function(){function t(t,e){var r=e.kFlight,a=e.kFrom,n=e.kTo,i=e.kStops,s=e.kDuration,p=e.passengerInformation,o=t.getSpan().nextText(r).nextText(a).nextText(n).nextText(i).nextText(s);if(!o.exists())return CONTINUE;for(var g=[],l=o.parentTag("table3").tagContents().nextTag("tr3").firstTag("tr3");l.exists()&&l.nextText(p).exists();){var u=l.nextTag("td3").tagContents(),c=u.innerCapture(/([\d]+)/,1),x=u.innerCapture(/^([A-Z]+)/,1);c=(""+c).substring(0,4);var h=l.firstTag("tr3").tagContents(),T=h.firstTag("td3").tagContents(),f=T.nextTag("td3").tagContents(),m=T.innerCapture(/^(.+) (.+)\n/,1),d=f.innerCapture(/^(.+) (.+)\n/,1),v=T.innerCapture(/^(.+) (.+)\n/,2),C=f.innerCapture(/^(.+) (.+)\n/,2);if(v.exists()&&6==(""+v).length){if(v=(""+v).substring(1,4),!C.exists()||6!=(""+C).length)break;C=(""+C).substring(1,4);var b=(""+T).split("\n")[1],N=b.split("-");b=N[0].split(" ")[1]+" "+N[1].split(" ")[0]+" "+N[1].split(" ")[1];var A=(""+T).split("\n")[2],S=t.getDetachedSpan(b+" "+A).innerDate(),k=(""+f).split("\n")[1],D=k.split("-");k=D[0].split(" ")[1]+" "+D[1].split(" ")[0]+" "+D[1].split(" ")[1];var y=(""+f).split("\n")[2],F=t.getDetachedSpan(k+" "+y).innerDate();ASSERT(c,x,S,v,k,C)&&g.push({airlineName:"Air Canada",flightNumber:c,airlineCode:x,departureDate:S,departureAirport:m,departureAirportCode:v,arrivalDate:F,arrivalAirport:d,arrivalAirportCode:C}),l=l.nextTag("tr3").firstTag("tr3")}else l=l.nextTag("tr3").firstTag("tr3")}return l=null,g}function e(t,e){var r=e.bookingReference,a={};return a.reference=t.getSpan().nextText(r).nextTag("td5").tagContents(),a}function r(t,e){var r=e.passengerInformation,a=e.seatSelection,n=e.priceTotal,i=t.getSpan().nextText(n).nextTag("th3").tagContents(),s=t.getSpan().nextText(n).parentTag("th3").tagContents();if(s.exists()){var p=(""+s).split("-");2==p.length&&(s=p[1].trim())}passengers=[];for(var o,g=t.getSpan().nextText(r).nextTag("table2").firstTag("th2");g.exists();){var l=(""+g.tagContents()).split(":");if(4!=l.length)break;passengerName=l[1].trim(),o=l[3].trim();var u={};(""+g.nextText(a).firstTag("td2").tagContents()).split(",").forEach(function(t){seatDetail=t.trim().split(" "),seatDetail.length>1&&(u[seatDetail[0]]=seatDetail[1])}),passengers.push({name:passengerName,price:i,currency:s,ticketNumber:o,seats:u}),g=g.nextTag("th2")}return g=null,passengers}function a(t,e,r){for(var a=[],n=0;n<t.length;n++)for(var i=t[n],s=0;s<e.length;s++){var p=e[s],o={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:i.airlineName,airlineCode:i.airlineCode,flightNumber:i.flightNumber,departureAirportFuzzy:i.departureAirport,departureAirportCode:i.departureAirportCode,departureTime:i.departureDate,arrivalAirportFuzzy:i.arrivalAirport,arrivalAirportCode:i.arrivalAirportCode,arrivalTime:i.arrivalDate},underName:{"@type":"http://schema.org/Person",name:p.name},reservationId:r.reference,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:p.price,priceCurrency:p.currency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:p.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:p.seats[i.airlineCode+i.flightNumber]}}};a.push(o)}return a}return function(n,i,s){var p=Scanner.fromMessage(n);return p.setLocale(i),a(t(p,s),r(p,s),e(p,s))}}).call();