(function(){return function(e,t,r){if(/(?:Your Delta itinerary has changed|Schedule Changes That Impact)/.test(e.subject)){var a=Scanner.fromMessage(e);a.setLocale(t);var i,n,s,o,p,m,g,u,h,l,c=[],d={};n=a.getSpan().innerCapture(r.nameExtractor,1),n.exists()&&(d[n]={name:n,seats:{},seatingType:{}}),i=a.getSpan().innerCapture(r.confirmationNumber,1);var f=a.getSpan().allInnerTagsFiltered("td8"),v=f.filter(function(e){return r.dateFilter.test(e)}),T=f.filter(function(e){return r.legInfoExtractor.test(e)}),S=T.map(function(e){return e.innerCapture(r.locationExtractor,1)}),N=T.map(function(e){return e.innerDate()}),b=[];f.forEach(function(e){if(e.getString().match(/\w{3,}\s\d{3,}/i)){var t=e.innerCapture(/(\d{3,})/,1),r=e.innerRegExp(/(\w{3,})/i);b.push({flightNo:t.getString(),airlineName:r.exists()?r.getString():""})}});var x=[];f.forEach(function(e,t,r){if(t+1<r.length&&r[t+1].getString().match(/Seat|Choose Seat/)){var a=r[t+1].innerCapture(/Seat ?(\d\w)/i,1);x.push({seatType:r[t].getString(),seatNo:a.exists()?a.getString():"Choose Seat"})}});for(var y=0,C=a.getSpan().nextText("UPDATE"),A=a.getSpan().nextText("Departs");;){var D=!1;if(!A.exists())break;C.exists()&&C.getStart()<A.getStart()&&(C=C.nextText("UPDATE"),D=!0),s=v[y],p=b[y].airlineName,o=b[y].flightNo,m=/delta/gi.test(p)?"DL":null,g=combineDateAndTime(s,N[2*y]),u=S[2*y],h=combineDateAndTime(s,N[2*y+1]),l=S[2*y+1],valid(o,d[n])&&(d[n].seats[o]=x[y].seatNo,d[n].seatingType[o]=x[y].seatType),ASSERT(p,o,u,g,l,h)&&c.push({airlineName:p,airlineCode:m,flightNumber:o,departureAirport:u,departureTime:g,arrivalAirport:l,arrivalTime:h,passengers:d}),D&&(A=A.nextText("Departs"),y+=1),A=A.nextText("Departs"),y+=1}for(var E=[],y=0;y<c.length;y++)for(var F=c[y],z=Object.keys(F.passengers),k=0;k<z.length;k++){var I=F.passengers[z[k]],P={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:F.airlineName,airlineCode:F.airlineCode,flightNumber:F.flightNumber,departureAirportFuzzy:F.departureAirport,departureAirportCode:F.departureCode,departureTime:F.departureTime,arrivalAirportFuzzy:F.arrivalAirport,arrivalAirportCode:F.arrivalCode,arrivalTime:F.arrivalTime},underName:{"@type":"http://schema.org/Person",name:I.name},reservationId:i,reservationStatus:"http://schema.org/ReservationConfirmed",reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:I.seats[F.flightNumber],seatingType:I.seatingType[F.flightNumber]}}};valid(I.membershipNumber,I.programName)&&(P.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:I.membershipNumber,programName:I.programName}),E.push(P)}if(E.length)return E}}}).call();