­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ !function(e){"use strict";window.widgetCountdown=function(t){var a,n=t.find(".jet-countdown-timer"),r=n.data("type"),s=null,o=n.data("due-date"),d=n.data("start-date"),i=n.data("expire-actions"),c=n.data("evergreen-interval"),u=n.data("restart-interval"),l={days:n.find('[data-value="days"]'),hours:n.find('[data-value="hours"]'),minutes:n.find('[data-value="minutes"]'),seconds:n.find('[data-value="seconds"]')},h=function(){if(s){var t=g(s,{days:l.days.length,hours:l.hours.length,minutes:l.minutes.length});e.each(t.parts,function(e){var t=l[e];t.length&&t.html(this)}),t.total<=0&&(clearInterval(a),v())}},f=function(t){t=t.toString();var a,n="";return 1===t.length&&(t=0+t),a=t.match(/\d{1}/g),e.each(a,function(e,t){n+=''+t+""}),n},g=function(e,t){var a=e-new Date,n=Math.floor(a/1e3%60),r=Math.floor(a/1e3/60%60),s=Math.floor(a/36e5%24),o=Math.floor(a/864e5);return(o<0||s<0||r<0)&&(n=r=s=o=0),t.days||(s+=24*o,o=0),t.hours||(r+=60*s,s=0),t.minutes||(n+=60*r,r=0),{total:a,parts:{days:f(o),hours:f(s),minutes:f(r),seconds:f(n)}}},v=function(){t.trigger("jetCountdownTimerExpire",t),i&&e.each(i,function(e,r){switch(r){case"redirect":var o=n.data("expire-redirect-url");o&&(window.location.href=o);break;case"message":t.find(".jet-countdown-timer-message").show();break;case"hide":n.hide();break;case"restart":s=(s=new Date).setSeconds(s.getSeconds()+u),h(),a=setInterval(h,1e3)}})},w=function(){var e=t.data("id"),a="jet_evergreen_countdown_due_date_"+e,n="jet_evergreen_countdown_interval_"+e,r=localStorage.getItem(a),s=localStorage.getItem(n),o=function(){var e=new Date,t=e.setSeconds(e.getSeconds()+c);return localStorage.setItem(a,t),localStorage.setItem(n,c),t};return null===r&&null===s?o():null!==r&&c!==parseInt(s,10)?o():r>0&&parseInt(s,10)===c?r:void 0};!function(){switch(r){case"due_date":s=new Date(1e3*o);break;case"evergreen":c>0&&(s=w());break;case"endless":var e=new Date,t=Math.abs(e.getTimezoneOffset()),n=new Date(1e3*d),i=Math.abs(n.getTimezoneOffset())-t;e>n&&(s=new Date(1e3*(d+u))),s&&e>s&&(s=s.setSeconds(s.getSeconds()+(Math.floor((e-s)/(1e3*u))+1)*u)),0!=i&&(s-=60*i*1e3)}h(),a=setInterval(h,1e3)}()}}(jQuery);