tribe.events=tribe.events||{},tribe.events.pro=tribe.events.pro||{},tribe.events.pro.widgets=tribe.events.pro.widgets||{},tribe.events.pro.widgets.countdown={},function(e,t){"use strict";var s=e(document);t.selectors={countdownWidget:".tribe-events-view--widget-countdown",time:'[data-js="tribe-events-widget-countdown-time"]',days:'[data-js="tribe-events-widget-countdown-days"]',hours:'[data-js="tribe-events-widget-countdown-hours"]',minutes:'[data-js="tribe-events-widget-countdown-minutes"]',seconds:'[data-js="tribe-events-widget-countdown-seconds"]',complete:'[data-js="tribe-events-widget-countdown-complete"]',hidden:".tribe-common-a11y-hidden"},t.constants={MINUTE_IN_SECONDS:60,HOUR_IN_SECONDS:3600,DAY_IN_SECONDS:86400},t.zeroPad=function(e){var t=parseInt(e,10);return t<10?"0"+t:t},t.updateTimer=function(e,s){if(!(s.seconds<=0))if(s.seconds-=1,s.seconds>0)s.elements.days.text(t.zeroPad(s.seconds/t.constants.DAY_IN_SECONDS)),s.elements.hours.text(t.zeroPad(s.seconds%t.constants.DAY_IN_SECONDS/t.constants.HOUR_IN_SECONDS)),s.elements.minutes.text(t.zeroPad(s.seconds%t.constants.HOUR_IN_SECONDS/t.constants.MINUTE_IN_SECONDS)),s.elements.seconds.length&&s.elements.seconds.text(t.zeroPad(s.seconds%t.constants.MINUTE_IN_SECONDS));else{s.elements.time.addClass(t.selectors.hidden.className()),s.elements.complete.removeClass(t.selectors.hidden.className());var n=e.data("tribeEventsCountdownWidgetTimerId");clearInterval(n)}},t.setupTimer=function(e,s){var n=setInterval(t.updateTimer,1e3,e,s);e.data("tribeEventsCountdownWidgetTimerId",n)},t.Timer=function(e,t){this.seconds=e,this.elements=t},t.setup=function(e){e.find(t.selectors.time);var s=parseInt(e.find(t.selectors.time).data("seconds"),10);if(!(s<=0)){var n={time:e.find(t.selectors.time),days:e.find(t.selectors.days),hours:e.find(t.selectors.hours),minutes:e.find(t.selectors.minutes),seconds:e.find(t.selectors.seconds),complete:e.find(t.selectors.complete)},o=new t.Timer(s,n);t.setupTimer(e,o)}},t.init=function(e,s,n,o){n.is(t.selectors.countdownWidget)&&t.setup(n)},t.ready=function(){s.on("afterSetup.tribeEvents",tribe.events.views.manager.selectors.container,t.init)},e(t.ready)}(jQuery,tribe.events.pro.widgets.countdown),window.tec=window.tec||{},window.tec.eventsPro=window.tec.eventsPro||{},window.tec.eventsPro.views=window.tec.eventsPro.views||{},window.tec.eventsPro.views.widgetCountdown={};