(()=>{var e,t;window.tribe_events_pro_admin=window.tribe_events_pro_admin||{event:{}},e=jQuery,(t=window.tribe_events_pro_admin).init=function(){if(this.init_settings(),e("#event_venue input, #event_venue select").on("change",(function(){const t=e("#saved_venue option:selected");if(0===t.val()){const t=e(this).closest("form"),n=t.find('[name="venue[Address]"]').val(),i=t.find('[name="venue[City]"]').val(),s=t.find('[name="venue[Country]"]').val(),o="US"===t.find('[name="venue[Country]"] option:selected').val()?t.find('[name="venue[State]"]').val():t.find('[name="venue[Province]"]').val(),r=t.find('[name="venue[Zip]"]').val();"function"==typeof codeAddress&&codeAddress(n+","+i+","+o+","+s+","+r)}else"function"==typeof codeAddress&&codeAddress(t.data("address"))})),e("#doaction, #doaction2").on("click",(function(t){const n=e(this).attr("id").substr(2);if("edit"===e('select[name="'+n+'"]').val()&&"tribe_events"===e(".post_type_page").val()){t.preventDefault();const n=[];e("#bulk-titles div").each((function(){const t=e(this).attr("id"),i=t.replace("ttle",""),s=e("#post-"+i+" .row-title").first().text(),o=e("<div/>").append(e(this).find("a"));e(this).html("").append(o).append(s),n[t]&&e(this).remove(),n[t]=!0}))}})),e("body").on("click",".ui-dialog-titlebar .ui-dialog-titlebar-close",(function(){window.tribe_events_pro_admin.recurrence.reset_submit_button()})),e('input[name="post[]"]').on("click",(function(){const t=e(this).val();e(this).is(":checked")?e('input[name="post[]"][value="'+t+'"]').prop("checked",!0):e('input[name="post[]"][value="'+t+'"]').prop("checked",!1)})),e(".wp-list-table.posts").on("click",".tribe-split",(function(){let t="";if(t=e(this).hasClass("tribe-split-all")?TribeEventsProAdmin.recurrence.splitAllMessage:TribeEventsProAdmin.recurrence.splitSingleMessage,!window.confirm(t))return!1})),e(".wp-admin.events-cal.edit-php #doaction").on("click",(function(t){"trash"===e('[name="action"] option:selected').val()&&e('.tribe-recurring-event-parent [name="post[]"]:checked').length>0&&!confirm(TribeEventsProAdmin.recurrence.bulkDeleteConfirmationMessage)&&t.preventDefault()})),"object"==typeof TribeEventsProRecurrenceUpdate){const o=e("div.tribe-events-recurring-update-msg"),r=o.find("img"),c=o.find("div.progress"),a=o.find("div.bar"),d=Date.now();function t(e){const t=Date.now()-d;e.html&&o.html(e.html),e.progress&&i(e.progress,e.progressText),e.continue&&(t<500?setTimeout(n,500-t):n()),e.complete&&(r.replaceWith(TribeEventsProRecurrenceUpdate.completeMsg),o.removeClass("updating").addClass("completed"),setTimeout(s,1e3))}function n(){const n={event:TribeEventsProRecurrenceUpdate.eventID,check:TribeEventsProRecurrenceUpdate.check,action:"tribe_events_pro_recurrence_realtime_update"};e.post(ajaxurl,n,t,"json")}function i(e,t){(e=parseInt(e))<0||e>100||(a.css("width",e+"%"),c.attr("title",t))}function s(){o.animate({opacity:0,height:"toggle"},1e3,(function(){o.remove()}))}setTimeout((function(){n(),i(TribeEventsProRecurrenceUpdate.progress,TribeEventsProRecurrenceUpdate.progressText)}))}e("body").on("change","#defaultCountry-select",(function(){const t=e("#tribe-field-eventsDefaultState"),n=e(".tribe-settings-form-wrap #tribe-field-eventsDefaultProvince"),i=e("p.tribe-saved-state"),s=e("p.tribe-saved-province"),o=e(this).val();"US"===o||"United States"===o?(n.hide(),s.hide(),t.show(),i.show()):(t.hide(),i.hide(),n.show(),s.show())})).find("#defaultCountry-select").trigger("change")},t.init_settings=function(){const t=e('[name="hideSubsequentRecurrencesDefault"]'),n=e('[name="userToggleSubsequentRecurrences"]');if(!t.length||!n.length)return;const i=e("#tribe-field-userToggleSubsequentRecurrences");t.is(":checked")&&(n.prop("checked",!1),i.hide()),t.on("click",(function(){e(this).is(":checked")?(n.prop("checked",!1),i.hide()):i.show()}))},e((function(){t.init()})),window.tec=window.tec||{},window.tec.eventsPro=window.tec.eventsPro||{},window.tec.eventsPro.eventsAdmin={}})();