(()=>{var e,t;tribe.events=tribe.events||{},tribe.events.youtubeSettingsAdmin=tribe.events.youtubeSettingsAdmin||{},e=jQuery,(t=tribe.events.youtubeSettingsAdmin).selectors={youtubeContainer:".tribe-settings-youtube-integration",youtubeAccordionContainer:".tribe-events-virtual-meetings-youtube-settings__accordion-wrapper",youtubeMessageContainer:".tec-youtube-accounts-messages",youtubeChannelIdContainer:".tribe-settings-youtube-integration__channel-id",youtubeDeleteChannelId:".tribe-settings-youtube-integration__delete-channel"},t.createMessageContainer=function(){e(t.selectors.youtubeMessageContainer).length||e(t.selectors.youtubeChannelIdContainer).find(".tribe-field-label").after(e("<div>",{class:"tec-youtube-accounts-messages"}))},t.bindEvents=function(){e(t.selectors.youtubeContainer).on("click",t.selectors.youtubeDeleteChannelId,t.handleDeleteChannelId)},t.handleDeleteChannelId=function(n){if(n.preventDefault(),confirm(tribe_events_virtual_youtube_settings_strings.deleteConfirm)){var i=e(this).data("ajaxDeleteUrl");e.ajax(i,{contentType:"application/json",context:e(this).closest(t.selectors.youtubeChannelIdContainer),success:t.onChannelIdDeleteSuccess})}},t.onChannelIdDeleteSuccess=function(n){e(t.selectors.youtubeMessageContainer).html(n),e(".error",e(t.selectors.youtubeMessageContainer)).length>0||(e(t.selectors.youtubeDeleteChannelId).prop("disabled",(function(e,t){return!t})),e(this).find("input").val(""))},t.initSettingsAccordion=function(){tribe.events.views.accordion&&tribe.events.views.accordion.bindAccordionEvents(e(t.selectors.youtubeAccordionContainer))},t.ready=function(){t.createMessageContainer(),t.bindEvents(),t.initSettingsAccordion()},e(t.ready),window.tec=window.tec||{},window.tec.eventsPro=window.tec.eventsPro||{},window.tec.eventsPro.eventsVirtualYoutubeSettings={}})();