// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("atgtickets-confirmation-en",function(e){return/^Confirmation of Order Number /.test(e.subject)},function(e){if(!/^Confirmation of Order Number /.test(e.subject))return CONTINUE;var t="en_GB",r={};r.reservationIdPrefix="Order #",r.namePrefix="Customer Number:",r.pricePrefix="TOTAL \xa3:",r.ticketDetailsPrefix="PRICE TYPE - PRICE ZONE",r.ticketDetailsSuffix="Additional Information:",r.eventTitleRegExp=/.+, ([^:]+): (.+)/,r.seatNumberRegExp=/Ticket Information\n(.+)\/([A-Z]+)\s*(\d+)/;var n=Scanner.fromMessage(e);n.setLocale(t);var a,i,s,o,c,m,p,g,f,u,x,v,h,d,S,l,T=[];for(a=n.getSpan().next(r.reservationIdPrefix).nextTag("td2").tagContents(),i=n.getSpan().next(r.namePrefix).nextTag("td3").nextTag("td3").tagContents(),s=n.getSpan().next(r.pricePrefix).nextTag("td3").tagContents(),s&&s.exists()&&(o=s.innerCapture(/([\d,.]+)/,1),c=s.innerCapture(/([^\d,.]+)/,1).trim()),l=n.getDetachedSpan(""+n.getSpan().next(r.ticketDetailsPrefix).withEnd(n.getSpan().next(r.ticketDetailsPrefix).next(r.ticketDetailsSuffix).getStart())),S=l.allInnerTagsFiltered("tr2"),d=0;d<S.length;d+=2)if(m=S[d].innerCapture(r.eventTitleRegExp),m&&3===m.length&&(p=m[1].trim(),g=m[2].trim()),h=S[d].nextDate(),f=S[d+1].innerCapture(r.seatNumberRegExp),f&&4===f.length&&(u=f[1].trim(),x=f[2].trim(),v=f[3].trim()),ASSERT(h)){var C={startDate:h,eventName:g,eventLocation:p,seatSection:u,seatRow:x,seatNumber:v};T.push(C)}var E=[];return T.forEach(function(e){if(ASSERT(a)){var t={"@context":"http://schema.org","@type":"http://schema.org/EventReservation",name:i,totalPrice:o,priceCurrency:c,reservationStatus:"http://schema.org/ReservationConfirmed",reservationId:a,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:e.seatNumber,seatRow:e.seatRow,seatSection:e.seatSection}},reservationFor:{"@type":"http://schema.org/Event",eventStatus:"http://schema.org/EventConfirmed",name:e.eventName,startDate:e.startDate,location:{"@type":"http://schema.org/Place",name:e.eventLocation}}};E.push(t)}}),E.length?E:void 0},"0/1/2/3/4/5/1248/1251/1252","SG01aa3e6d")]);