tribe.tickets=tribe.tickets||{},tribe.dialogs=tribe.dialogs||{},tribe.dialogs.events=tribe.dialogs.events||{},tribe.tickets.emails={},function(e,t){const i=e(document);t.selectors={modalWrapper:".tribe-modal__wrapper--emails-preview",modalTitle:".tribe-modal__title",modalContent:".tribe-modal__content",form:".tribe-tickets__manual-attendees-form",hiddenElement:".tribe-common-a11y-hidden",formCurrentEmail:"tec_tickets_emails_current_section",formHeaderImageUrl:"tec-tickets-emails-header-image-url",formHeaderImageAlignment:"tec-tickets-emails-header-image-alignment",formTicketBgColorName:"tec-tickets-emails-ticket-bg-color",formHeaderBgColorName:"tec-tickets-emails-header-bg-color",formFooterContent:"tec-tickets-emails-footer-content",formFooterCredit:"tec-tickets-emails-footer-credit",formQrCodes:"tec-tickets-emails-ticket-include-qr-codes"},t.modalClose=function(i,o){const n=e(o).find(t.selectors.modalContent);t.unbindModalEvents(n)},t.bindModalClose=function(){e(tribe.dialogs.events).on("tribeDialogCloseEmailsPreviewModal.tribeTickets",t.modalClose)},t.bindModalEvents=(e,t,i)=>{},t.unbindModalEvents=function(e){e.off("afterAjaxSuccess.tribeTicketsAdmin",t.bindModalEvents),e.off()},t.modalOpen=function(i,o,n){const r=e(o),a=e(n.target).closest("button").data("modal-title");a&&r.find(t.selectors.modalTitle).html(a);const s=r.find(t.selectors.modalContent),c={action:"tribe_tickets_admin_manager",request:"tec_tickets_preview_email",...t.getSettingsContext()};tribe.tickets.admin.manager.request(c,s),s.on("afterAjaxSuccess.tribeTicketsAdmin",{container:s,requestData:c},t.bindModalEvents)},t.getSettingsContext=function(){const e={},o=window.tinyMCE||void 0,n=i.find("input[name="+t.selectors.formCurrentEmail+"]").val();if(e.currentEmail=n,n){const t=(e,t,i)=>(e[t.name.replace(`${i}-`,"").replace(/-([a-z])/g,(e=>e[1].toUpperCase())).replace(/\[]$/,"")]="checkbox"===t.type?t.checked:t.value,e);e.useTicketEmail=!1;const r="tec-tickets-emails-ticket";Array.from(i.find("input[name^="+r+"]")).reduce(((e,i)=>t(e,i,r)),e);const a=n.replace(/_/g,"-");Array.from(i.find("input[name^="+a+"]")).reduce(((e,i)=>t(e,i,a)),e),e.addContent=void 0!==o?o.get(a+"-additional-content").getContent():""}else{const n=i.find("input[name="+t.selectors.formTicketBgColorName+"]").val();e.ticketBgColor=n;const r=i.find("input[name="+t.selectors.formHeaderBgColorName+"]").val();e.headerBgColor=r;const a=i.find("input[name="+t.selectors.formHeaderImageUrl+"]").val();e.headerImageUrl=a;const s=i.find("select[name="+t.selectors.formHeaderImageAlignment+"]").val();e.headerImageAlignment=s;const c=i.find("input[name="+t.selectors.formFooterCredit+"]").is(":checked");e.footerCredit=c,e.footerContent=void 0!==o?o.get(t.selectors.formFooterContent).getContent():"",e.eventLinks=!0,e.qrCodes=!0,e.arFields=!0}return e},t.bindModalOpen=function(){e(tribe.dialogs.events).on("tribeDialogShowEmailsPreviewModal.tribeTickets",t.modalOpen)},t.ready=function(){t.bindModalOpen(),t.bindModalClose()},i.ready(t.ready)}(jQuery,tribe.tickets.emails),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.admin=window.tec.tickets.admin||{},window.tec.tickets.admin.ticketsEmails={};