// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(t,e,n){var a=Scanner.fromMessage(t);a.setLocale(e);var r,i,s,o,c,p,g,h,m,v,f,u=[];r=a.getSpan().innerCapture(n.reservationIdRegExp,1).trim(),n.nameRegExp&&(i=a.getSpan().innerCapture(n.nameRegExp,1).trim()),s=a.getSpan().next(n.pricePrefix).nextTag("td1").tagContents(),s&&s.exists()&&(o=s.innerCapture(/([\d,.]+)/,1),c=s.innerCapture(/([^\d,.]+)/,1).trim()),f=a.getDetachedSpan(""+a.getSpan().next(n.ticketDetailsPrefix).withEnd(a.getSpan().next(n.ticketDetailsPrefix).next(n.ticketDetailsSuffix).getStart())),m=f.allInnerTags("tr1"),m.forEach(function(t){if(v=t.allInnerTags("td1"),6!==v.length)return CONTINUE;if(!/^\d+$/.test(v[0].tagContents().trim()))return CONTINUE;if(g=v[1].tagContents(),h=v[2].innerDate(),ASSERT(h)){var e={startDate:h,eventName:g,eventLocation:p};u.push(e)}});var S=[];if(u.forEach(function(t){if(ASSERT(r)){var e={"@context":"http://schema.org","@type":"http://schema.org/EventReservation",name:i,totalPrice:o,priceCurrency:c,reservationStatus:"http://schema.org/Reservation"+(n.reservationStatus||"Confirmed"),reservationId:r,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat"}},reservationFor:{"@type":"http://schema.org/Event",eventStatus:"http://schema.org/EventConfirmed",name:t.eventName,startDate:t.startDate,location:{"@type":"http://schema.org/Place",name:t.eventLocation}}};S.push(e)}}),S.length)return S}}).call();