(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,s,m,l,u,g,h,c,d,C,v,f,S=[];if(s=a.getSpan().innerCapture(t.reservationId,1).trim(),t.hotelName.test(e.plain)){n=/i.JTB/.test(e.subject)?a.getSpan().innerCapture(t.guestName_new,2):a.getSpan().innerCapture(t.guestName,1),h=a.getSpan().innerCapture(regExpFormatted(/\1\s+.(.*)\(/,t.hotelName),1),h.exists()||(h=a.getSpan().innerCapture(regExpFormatted(/\1\s+.(.*)\(/,t.hotelName_new),1)),c=a.getSpan().innerCapture(t.hotelPhone,1);if(p=a.getSpan().innerCapture(t.price,1).innerCapture(/([\d,.]+)/,1),l=a.getSpan().next(t.checkinDate).nextDate(),t.emailTitleConfirmation.test(e.subject)){if(!ASSERT(n,s,l,h))return CONTINUE;m="Confirmed"}if(t.emailTitleCancelConfirmation.test(e.subject)){if(!ASSERT(n,s,l,h))return CONTINUE;m="Cancelled"}var T={"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:n,email:i},totalPrice:p,priceCurrency:o,checkinTime:l,checkoutTime:u,modifyReservationUrl:C,cancelReservationUrl:v,reservationStatus:"http://schema.org/Reservation"+(m||"Confirmed"),reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:h,url:g,telephone:c,address:d}};S.push(T)}var x,E,F,N,A,y=[],b=[];if(t.flightCheck.test(e.plain)){for(var D=a.getSpan().innerCapture(regExpFormatted(/\1\s+(.+?\(.*\))/,t.flight),1);(""+D).match(/JAL/);)y.push(D),D=D.nextRegExp(regExpFormatted(/\n\s+.(.+?)\(.*\)/)).trim();for(var R=0;R<y.length;R++){var k=a.getDetachedSpan(""+y[R]).allInnerDates(),I=unSpanDate_(k[0]),z=y[R].innerCapture(/($<airlineCode>[A-Z]{2,3})($<flightNumber>\d+)/),U=z.$airlineCode,j=z.$flightNumber;if(I=a.getDetachedSpan(I),3===k.length)x=y[R].innerCapture(regExpFormatted(/\1\s(.+?)[\u2192\u21d2](.+)\s?/,""+z[0])),E=x[1].innerCapture(/(.+?)\(.+\)/,1).trim(),F=x[2].innerCapture(/(.+?)\(.+\)/,1).trim(),N=x[1].innerCapture(/.+?\((.+)\)/,1).trim(),A=x[2].innerCapture(/.+?\((.+)\)/,1).trim();else{x=y[R].innerCapture(regExpFormatted(/\1\s(.+?)[\u2192\u21d2](.+)\s/,""+z[0])),E=x[1].trim(),F=x[2].trim();var L=y[R].lastInnerDate().innerCapture(/(.+?)-(.+)/);N=a.getDetachedSpan(L[1]+":00"),A=a.getDetachedSpan(L[2]+":00")}var P=combineDateAndTime(I,N),$=combineDateAndTime(I,A);ASSERT(P,$,E,F)&&b.push({airlineCode:U,flightNumber:j,departureAirport:E,arrivalAirport:F,departureTime:P,arrivalTime:$})}for(var _=[],w=a.getSpan().innerCapture(regExpFormatted(/\1\d\s+.*/,t.passenger),0);w.exists();){_.push({name:w.innerCapture(regExpFormatted(/\1\d\s+.(.*?)\d/,t.passenger),1).trim()}),w=w.nextRegExp(regExpFormatted(/\1\d\s+.(.*)/,t.passenger),1)}t.emailTitleConfirmation.test(e.plain)&&(f="Confirmed"),t.emailTitleCancelConfirmation.test(e.subject)&&(f="Cancelled");for(var R=0;R<b.length;R++)for(var B=b[R],J=0;J<_.length;J++){var O=_[J],T={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:B.airlineCode,flightNumber:B.flightNumber,departureAirportFuzzy:B.departureAirport,departureTime:B.departureTime,arrivalAirportFuzzy:B.arrivalAirport,arrivalTime:B.arrivalTime},underName:{"@type":"http://schema.org/Person",name:O.name},checkinUrl:null,reservationId:s,reservationStatus:"http://schema.org/Reservation"+(f||"Confirmed"),reservedTicket:{"@type":"http://schema.org/Ticket"}};S.push(T)}}if(S.length)return S}}).call();