(()=>{"use strict";const{fieldSelector:e,containerSelector:t,differentProviderNoticeSelector:r,differentProviderNoticeTemplate:n}=window.TECFtEditorData.seriesRelationship,c=t+" "+r;function o(e,t){if(!e||!e.value)return null;const r=e.value;try{return JSON.parse(r)[t]||null}catch(e){return null}}function i(e,t){return e.currentTarget?o(e.currentTarget,t):null}function l(){Array.from(document.querySelectorAll(c)).map((e=>e.remove(!0)))}const s=e=>{"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)};s((function(){if(void 0===window.TECFtEditorData||void 0===window.TECFtEditorData.seriesRelationship||void 0===window.TECFtEditorData.classic)return;const{ticketPanelEditSelector:c,ticketPanelEditDefaultProviderAttribute:s,ticketsMetaboxSelector:u}=window.TECFtEditorData.classic,a=jQuery(u);function d(){return document.getElementById(c.substring(1)).getAttribute(s)}function y(e,c,o){if(e===c||null===e||null===c)return Array.from(document.querySelectorAll("#publish,#save-post")).forEach((e=>e.disabled=!1)),void l();Array.from(document.querySelectorAll("#publish,#save-post")).forEach((e=>e.disabled=!0)),function(e,c){l();const o=document.createElement("div");o.classList.add(r.substring(1)),o.style["margin-top"]="var(--tec-spacer-1)",o.textContent=n.replace("%1$s",e).replace("%2$s",c),document.querySelector(t).append(o)}(document.getElementById("title").value,o)}var f;f=function(e){const t=function(e){return i(e,"ticket_provider")}(e),r=d(),n=function(e){return i(e,"title")||""}(e);y(r,t,n)},jQuery(e).on("change",f),a.on("after_panel_swap.tickets",(function(){const t=o(document.getElementById(e.substring(1)),"ticket_provider");y(d(),t,o(document.getElementById(e.substring(1)),"title"))}))}));const u=".recurrence-row",a=".recurrence-row.tec-events-pro-recurrence-not-supported",d=".tribe-tickets-editor-table-tickets-body",y=d+' [data-ticket-type="rsvp"]',f=d+' [data-ticket-type="default"]',w=".tec_ticket-panel__recurring-unsupported-warning",m="#ticket_form_toggle, #rsvp_form_toggle, #settings_form_toggle, .tec_ticket-panel__helper_text__wrap";let p={hasRecurrenceRules:window?.TECFtEditorData?.event?.isRecurring||!1,hasOwnTickets:window?.TECFtEditorData?.event?.hasOwnTickets||!1},h=Object.assign({},p);function b(e){h=Object.assign({},p),p=Object.assign({},p,e),h.hasRecurrenceRules===p.hasRecurrenceRules&&h.hasOwnTickets===p.hasOwnTickets||S(p)}function E(){document.querySelectorAll(u).forEach((e=>{e.style.display="none"})),document.querySelectorAll(a).forEach((e=>{e.style.display="contents",e.style.visibility="visible"}))}function v(){p.hasRecurrenceRules?document.querySelectorAll(u).forEach((e=>{e.style.display=""})):(document.querySelectorAll(".recurrence-row.tribe-recurrence-description, .recurrence-row.tribe-recurrence-exclusion-row").forEach((e=>{e.style.display="none"})),document.querySelectorAll(".recurrence-row.tribe-datetime-block:not(.tribe-recurrence-exclusion-row)").forEach((e=>{e.style.display=""}))),document.querySelectorAll(a).forEach((e=>{e.style.display="none"}))}function g(){document.querySelectorAll(w).forEach((e=>{e.style.display="none"})),document.querySelectorAll(m).forEach((e=>{e.style.display=""}))}function k(){document.querySelectorAll(w).forEach((e=>{e.style.display=""})),document.querySelectorAll(m).forEach((e=>{e.style.display="none"}))}function S(e){return e.hasRecurrenceRules||e.hasOwnTickets?e.hasOwnTickets&&e.hasRecurrenceRules?(E(),void k()):e.hasOwnTickets?(E(),void g()):(v(),void k()):(v(),void g())}s((()=>S(p)));const A=document.querySelector(".recurrence-container");A&&new MutationObserver((()=>{b({hasRecurrenceRules:document.querySelectorAll(".recurrence-container .tribe-event-recurrence-rule").length>0})})).observe(A,{childList:!0});const T=document.getElementById("tribetickets");T&&new MutationObserver((()=>{b({hasOwnTickets:document.querySelectorAll(y).length||document.querySelectorAll(f).length||document.querySelectorAll('#tribe_panel_edit[aria-hidden="false"]').length})})).observe(T,{childList:!0,subtree:!0,attributes:!0}),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.flexibleTickets=window.tec.tickets.flexibleTickets||{},window.tec.tickets.flexibleTickets.classicEditor={}})();