jQuery(document).ready(function ($){
function wpcd_moreLessDescription(){
var num_words=Number(wpcd_main_js.word_count);
var full_description=$('.wpcd-full-description');
var more=$('.wpcd-more-description');
var less=$('.wpcd-less-description');
full_description.each(function (){
$this=$(this);
var full_content=$this.html();
var check=full_content.split(' ').length > num_words;
if(check){
var short_content=full_content.split(' ').slice(0, num_words).join(' ');
$this.siblings('.wpcd-short-description').html(short_content + '...');
$this.hide();
$this.siblings('.wpcd-less-description').hide();
}else{
$(this).siblings('.wpcd-more-description').hide();
$(this).siblings('.wpcd-more-description');
$(this).siblings('.wpcd-less-description').hide();
$(this).siblings('.wpcd-short-description').hide();
}});
more.click(function (e){
e.preventDefault();
$(this).siblings('.wpcd-full-description').show();
$(this).siblings('.wpcd-less-description').show();
$(this).siblings('.wpcd-short-description').hide();
$(this).hide();
});
less.click(function (e){
e.preventDefault();
$(this).siblings('.wpcd-short-description').show();
$(this).siblings('.wpcd-more-description').show();
$(this).siblings('.wpcd-full-description').hide();
$(this).hide();
});
};
wpcd_moreLessDescription();
$.each($('#wpcd_cat_ul > li'), function (){
if($(this).children('a').attr('href')===window.location.href){
$(this).children('a').addClass('active');
}});
var categories_pagination_set_timeout;
var wpcd_js_data_tax='data-category';
if($('#wpcd_cat_ul .wpcd_category').attr('data-category') ){
wpcd_js_data_tax='data-category';
}else if($('#wpcd_cat_ul .wpcd_category').attr('data-vendor') ){
wpcd_js_data_tax='data-vendor';
}
function wpcd_ajaxCouponCategoriesPagination(wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text){
var scrollTop=$('#wpcd_coupon_template').offset().top;
$('html, body').animate({ scrollTop: scrollTop }, 300);
$('.wpcd_coupon_loader').removeClass('wpcd_coupon_hidden_loader');
clearTimeout(categories_pagination_set_timeout);
categories_pagination_set_timeout=setTimeout(function (){
var coupon_template;
var coupon_items_count;
var wpcd_data_coupon_page_url;
var wpcd_data_category_coupons;
var wpcd_data_vendor_coupons;
var wpcd_data_ven_cat_id;
var wpcd_coupon_taxonomy_category;
var wpcd_coupon_taxonomy_vendor;
if(wpcd_js_data_tax=='data-category'){
var wpcd_coupon_taxonomy_category=wpcd_coupon_taxonomy;
}else if(wpcd_js_data_tax=='data-vendor'){
var wpcd_coupon_taxonomy_vendor=wpcd_coupon_taxonomy;
}
var wpcd_coupon_template=$('#wpcd_coupon_template');
if(wpcd_coupon_template.length > 0){
coupon_template=wpcd_coupon_template.attr('wpcd-data-coupon_template');
coupon_items_count=wpcd_coupon_template.attr('wpcd-data-coupon_items_count');
wpcd_data_coupon_page_url=wpcd_coupon_template.attr('wpcd-data-coupon_page_url');
wpcd_data_category_coupons=wpcd_coupon_template.attr('wpcd-data_category_coupons');
wpcd_data_vendor_coupons=wpcd_coupon_template.attr('wpcd-data_vendor_coupons');
wpcd_data_ven_cat_id=wpcd_coupon_template.attr('wpcd-data_ven_cat_id');
}
if(!coupon_template){
coupon_template=undefined;
}
if(!wpcd_page_num){
wpcd_page_num=undefined;
}
if(!search_text){
search_text=undefined;
}
$.ajax({
type: 'post',
dataType: 'json',
url: wpcd_object.ajaxurl,
data: {
action: action,
security: wpcd_object.security,
wpcd_category: wpcd_coupon_taxonomy_category,
wpcd_vendor: wpcd_coupon_taxonomy_vendor,
coupon_template: coupon_template,
coupon_items_count: coupon_items_count,
wpcd_data_coupon_page_url: wpcd_data_coupon_page_url,
wpcd_data_category_coupons: wpcd_data_category_coupons,
wpcd_data_vendor_coupons: wpcd_data_vendor_coupons,
wpcd_data_ven_cat_id: wpcd_data_ven_cat_id,
wpcd_page_num: wpcd_page_num,
search_text: search_text
},
success: function(response){
if(response){
var coupon_container=$('.wpcd_coupon_archive_container');
if(coupon_container.length > 0){
coupon_container.html(response);
$('.wpcd_coupon_loader').addClass('wpcd_coupon_hidden_loader');
$('#wpcd_coupon_pagination_wr a.page-numbers').off('click');
$('#wpcd_coupon_pagination_wr a.page-numbers').on('click', function(e){
e.preventDefault();
var href=$(this).attr('href');
var href_arr=wpcd_getUrlVar(href);
var wpcd_page_num=href_arr['wpcd_page_num'];
var search_text=href_arr['search_text'];
var this_parrent=$(this).parent('#wpcd_coupon_pagination_wr');
var action=this_parrent.attr('wpcd-data-action');
wpcd_ajaxCouponCategoriesPagination(wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text);
});
wpcd_countDownFun($);
$('.masterTooltip').hover(function (){
var title=$(this).attr('title');
$(this).data('tipText', title).removeAttr('title');
$('<p class="wpcd-copy-tooltip"></p>')
.text(title)
.appendTo('body')
.fadeIn('slow');
}, function (){
$(this).attr('title', $(this).data('tipText') );
$('.wpcd-copy-tooltip').remove();
}).mousemove(function(e){
var mousex=e.pageX + 20;
var mousey=e.pageY + 10;
$('.wpcd-copy-tooltip')
.css({ top: mousey, left: mousex })
});
$.each($('#wpcd_cat_ul  li'), function (){
if($(this).children('a').attr(wpcd_js_data_tax)==wpcd_coupon_taxonomy){
$(this).children('a').addClass('active');
}else{
$(this).children('a').removeClass('active');
}});
wpcd_moreLessDescription();
}}else{
}}
});
}, 500);
};
function wpcdDocumentEventGenerate(eventName, element, details){
if(eventName&&element){
if(! details){
details=true;
}
let event=new CustomEvent(eventName, { detail: details, bubbles: true });
element.dispatchEvent(event);
}}
let wpcdCatUl=document.querySelector('#wpcd_cat_ul');
if(wpcdCatUl){
let wpcdDropdownContent=wpcdCatUl.querySelector('.wpcd_dropdown-content');
let wpcdDropbtn=wpcdCatUl.querySelector('.wpcd_dropbtn');
if(wpcdDropdownContent){
wpcdCatUl.addEventListener('mouseenter', function(){
wpcdDropdownContent.style.display='block';
}, false);
wpcdCatUl.addEventListener('mouseleave', function(){
wpcdDropdownContent.style.display='none';
}, false);
if(wpcdDropbtn&&wpcdDropbtn.style.display!=='none'){
wpcdDropbtn.addEventListener('click', function (){
wpcdDropdownContent.style.display='block';
}, false);
}}
$('#wpcd_cat_ul .wpcd_category').on('click', function (e){
e.preventDefault();
wpcdDocumentEventGenerate('mouseleave', wpcdCatUl);
var wpcd_coupon_taxonomy=$(this).attr(wpcd_js_data_tax);
wpcd_ajaxCouponCategoriesPagination('', 'wpcd_coupons_category_action', wpcd_js_data_tax, wpcd_coupon_taxonomy);
});
}
$('#wpcd_coupon_pagination_wr a.page-numbers').on('click', function (e){
e.preventDefault();
var href=$(this).attr('href');
var href_arr=wpcd_getUrlVar(href);
var wpcd_page_num=href_arr['wpcd_page_num'];
var wpcd_coupon_taxonomy=href_arr['wpcd_category'];
if(! wpcd_coupon_taxonomy){
wpcd_coupon_taxonomy=href_arr['wpcd_vendor'];
}
var search_text=href_arr['search_text'];
var this_parrent=$(this).parent('#wpcd_coupon_pagination_wr');
var action=this_parrent.attr('wpcd-data-action');
wpcd_ajaxCouponCategoriesPagination(wpcd_page_num, action, wpcd_js_data_tax, wpcd_coupon_taxonomy, search_text);
});
let delayTimer;
$('.wpcd_searchbar_search input').on('input', function (e){
clearTimeout(delayTimer);
delayTimer=setTimeout(()=> {
let search_string=$(this).val();
wpcd_ajaxCouponCategoriesPagination('1', 'wpcd_coupons_category_action', wpcd_js_data_tax, 'all', search_string);
}, 800);
})
function wpcd_getUrlVar(urlVar){
var urlVar=urlVar;
var arrayVar=[];
var valueAndKey=[];
var resultArray=[];
arrayVar=(urlVar.substr(1)).split('&');
if(arrayVar[0]=="") return false;
for (i=0; i < arrayVar.length; i++){
valueAndKey=arrayVar[i].split('=');
resultArray[valueAndKey[0]]=valueAndKey[1];
}
return resultArray;
}
function wpcd_categoriesDropdown(){
var sw=jQuery(".wpcd_div_nav_block").width();
if(sw < 850){
jQuery(".wpcd_categories_in_dropdown > div").addClass('wpcd_dropdown-content');
jQuery(".wpcd_categories_in_dropdown > a").css('display', 'inline');
}else{
jQuery(".wpcd_categories_in_dropdown > div").removeClass('wpcd_dropdown-content');
jQuery(".wpcd_categories_in_dropdown > a").css('display', 'none');
}}
wpcd_categoriesDropdown();
function wpcd_countDownFun(){
var count_down_span=$('[data-countdown_coupon]');
count_down_span.each(function (){
var $this=$(this), finalDate=$(this).data('countdown_coupon');
$this.countdown(finalDate, function (event){
var format='%M ' + wpcd_main_js.minutes + ' %S ' + wpcd_main_js.seconds;
if(event.offset.hours > 0){
format='%H ' + wpcd_main_js.hours + ' %M ' + wpcd_main_js.minutes + ' %S ' + wpcd_main_js.seconds;
}
if(event.offset.totalDays > 0){
format='%-d ' + wpcd_main_js.day + '%!d ' + format;
}
if(event.offset.weeks > 0){
format='%-w ' + wpcd_main_js.week + '%!w ' + format;
}
if(event.offset.weeks==0&&event.offset.totalDays==0&&event.offset.hours==0&&event.offset.minutes==0&&event.offset.seconds==0){
jQuery(this).parent().addClass('wpcd-countdown-expired').html(wpcd_main_js.expired_text);
}else{
jQuery(this).html(event.strftime(format));
}}).on('finish.countdown', function (event){
jQuery('.wpcd-coupon-two-countdown-text').hide();
jQuery(this).html(wpcd_main_js.expired_text).parent().addClass('disabled');
});
});
}
wpcd_countDownFun();
});
jQuery(document).ready(function ($){
$('.fb-share,.tw-share,.go-share').click(function (e){
e.preventDefault();
window.open($(this).attr('href'), 'fbShareWindow', 'height=450, width=550, top='
+ ($(window).height() / 2 - 275) + ', left=' + ($(window).width() / 2 - 225)
+ ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});
$('a[class^=wpcd-vote]').click(function (e){
e.preventDefault();
var $this=$(this),
coupon_id=$this.data('id'),
meta="up",
el_sibling_percentage=$this.siblings(".wpcd-vote-percent"),
el_percentage=$('.wpcd-vote-percent[data-id=' + coupon_id + ']');
if($this.hasClass("wpcd-vote-down")){
meta="down";
}
var data={
'action': 'wpcd_vote',
'security': wpcd_object.security,
'meta': meta,
'coupon_id': coupon_id,
};
jQuery.post(wpcd_object.ajaxurl, data, function (response){
if(response==="Failed"){
wpcd_displayMsg(wpcd_main_js.vote_failed, el_percentage, 2000);
}else if(response==="voted"){
wpcd_displayMsg(wpcd_main_js.vote_already, el_sibling_percentage, 2000);
}else{
wpcd_displayMsg(wpcd_main_js.vote_success, el_percentage, 2000);
setTimeout(function (){
wpcd_displayMsg(response, el_percentage, 0);
}, 2000);
}});
function wpcd_displayMsg(Msg, el, Time=0){
if(typeof (el)==="object"){
if(Time===0){
el.html(Msg);
}else{
var old_text=el.html();
el.html(Msg);
setTimeout(function (){
el.html(old_text);
}, Time);
}}
}});
});
jQuery(document).ready(function ($){
$(document).ready(function (){
$('.masterTooltip').hover(function (){
var title=$(this).attr('title');
$(this).data('tipText', title).removeAttr('title');
$('<p class="wpcd-copy-tooltip"></p>')
.text(title)
.appendTo('body')
.fadeIn('slow');
}, function (){
$(this).attr('title', $(this).data('tipText'));
$('.wpcd-copy-tooltip').remove();
}).mousemove(function (e){
var mousex=e.pageX + 20;
var mousey=e.pageY + 10;
$('.wpcd-copy-tooltip')
.css({ top: mousey, left: mousex })
});
});
jQuery(".wpcd_coupon_popup_layer, .wpcd_coupon_popup_close").click(function (){
jQuery(".wpcd_coupon_popup_wr").fadeOut();
});
function wpcd_archiveSectionSmall(){
var wpcd_archive_section_grid=jQuery(".wpcd_archive_section_grid");
var sw=wpcd_archive_section_grid.width();
if(wpcd_archive_section_grid.length > 0){
if(sw < 1000){
jQuery(".wpcd_archive_section_grid").addClass("wpcd_archive_section_small");
if(sw < 600){
jQuery(".wpcd_archive_section_grid").addClass("wpcd_archive_section_mini");
if(sw < 400){
jQuery(".wpcd_archive_section_grid").addClass("wpcd_archive_section_mini_share");
}else{
jQuery(".wpcd_archive_section_grid").removeClass("wpcd_archive_section_mini_share");
}}else{
jQuery(".wpcd_archive_section_grid").removeClass("wpcd_archive_section_mini");
}}else{
jQuery(".wpcd_archive_section_grid").removeClass("wpcd_archive_section_small");
}}
}
wpcd_archiveSectionSmall();
$(window).resize(function (){
wpcd_archiveSectionSmall();
});
$.wpcd_urlParam=function (name){
var results=new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if(results==null){
return null;
}else{
return decodeURI(results[1])||0;
}}
var wpcd_id=$.wpcd_urlParam('wpcd_coupon');
var code_section=$('.wpcd-coupon-id-' + wpcd_id + '.coupon-code-wpcd.coupon-detail.wpcd-coupon-button-type a');
code_section.children('.get-code-wpcd').hide();
code_section.each(function (){
var cnt=$(this).contents();
var div=$(this).replaceWith($('<div class="active coupon-code-wpcd"></div>').append(cnt));
});
});
jQuery(document).ready(function ($){
$(window).resize(wpcd_updateCouponClassRan);
function wpcd_updateCouponClassRan(){
}
function wpcd_updateCouponClass(class_box, class1, class2, width1, width2){
$.each($(class_box), function (){
if($(this).width() > width1){
$(this).removeClass(class1);
}else{
$(this).addClass(class1);
}
if($(this).width() > width2){
$(this).removeClass(class2);
}else{
$(this).addClass(class2);
}});
}
wpcd_updateCouponClassRan();
});
function wpcd_printCoupon(printingElemDataUnic, cssHref){
if(! printingElemDataUnic||! cssHref) return;
let printingElem=document.querySelector('[data-unic-attr="' + printingElemDataUnic + '"]');
if(! printingElem) return;
if(! Boolean(window.chrome) ){
let winWidth=printingElem.offsetWidth ? printingElem.offsetWidth:'800';
let winHeight=printingElem.offsetHeight ? printingElem.offsetHeight:'640';
let win=window.open('','','left=50,top=50,width=' + winWidth + ',height=' + winHeight + ',toolbar=0,scrollbars=1,status=0');
let printingCSS='<link rel="stylesheet" href="' + cssHref + '" type="text/css" />';
let wpcdStyleInlineCss='';
if(head=document.head) wpcdStyleInlineCss=head.querySelector('#wpcd-style-inline-css');
wpcdStyleInlineCss.innerHTML=wpcdStyleInlineCss.innerHTML + '@media print {*{-moz-color-adjust: exact;}}';
win.document.write(printingCSS);
win.document.write(wpcdStyleInlineCss.outerHTML);
win.document.write(printingElem.outerHTML);
setTimeout(function (){
win.print();
win.close();
}, 500);
}else{
document.body.innerHTML=printingElem.outerHTML;
setTimeout(function (){
window.print();
window.location.reload(true);
}, 500);
}}
function wpcd_copyToClipboard(element){
var $temp=jQuery("<input>");
jQuery("body").append($temp);
$temp.val(jQuery(jQuery(element)[0]).text()).select();
document.execCommand ("copy");
$temp.remove();
}
function wpcd_openCouponAffLink(objectThis, CoupenId, wpcd_dataTaxonomy, numCoupon){
var a=jQuery(objectThis);
var oldLink=a.attr('href');
var wpcd_couponTaxonomy;
var wpcdPageNum;
var oldLinkArrPrepare=oldLink.replace("?", "");
var oldLinkArr=oldLinkArrPrepare.split('&');
for (var i=0; i < oldLinkArr.length; i++){
if(oldLinkArr[i].indexOf(wpcd_dataTaxonomy + '=') > -1){
wpcd_couponTaxonomy=oldLinkArr[i].split('=')[1];
}
if(oldLinkArr[i].indexOf('wpcd_page_num=') > -1){
wpcdPageNum=oldLinkArr[i].split('=')[1];
}}
if(window.location.href.indexOf('wpcd_coupon') > -1){
var wpcd_id=jQuery.wpcd_urlParam('wpcd_coupon');
oldLink=window.location.href.replace("wpcd_coupon=" + wpcd_id, "wpcd_coupon=" + CoupenId);
if(window.location.href.indexOf('wpcd_num_coupon') > -1){
var num_coupon=jQuery.wpcd_urlParam('wpcd_num_coupon');
if(numCoupon){
oldLink=oldLink.replace("wpcd_num_coupon=" + num_coupon, "wpcd_num_coupon=" + numCoupon);
}else{
oldLink=oldLink.replace("&wpcd_num_coupon=" + num_coupon, "");
}}else if(numCoupon){
oldLink=oldLink + "&wpcd_num_coupon=" + numCoupon;
}
if(window.location.href.indexOf(wpcd_dataTaxonomy) > -1){
var wpcd_coupon_taxonomy=jQuery.wpcd_urlParam(wpcd_dataTaxonomy);
if(wpcd_couponTaxonomy){
oldLink=oldLink.replace(wpcd_dataTaxonomy + "=" + wpcd_coupon_taxonomy, wpcd_dataTaxonomy + "=" + wpcd_couponTaxonomy);
}else{
oldLink=oldLink.replace("&" + wpcd_dataTaxonomy + "=" + wpcd_coupon_taxonomy, "");
}}else if(wpcd_couponTaxonomy){
oldLink=oldLink + "&" + wpcd_dataTaxonomy + "=" + wpcd_couponTaxonomy;
}
if(window.location.href.indexOf('wpcd_page_num') > -1){
var wpcd_page_num=jQuery.wpcd_urlParam('wpcd_page_num');
if(wpcdPageNum){
oldLink=oldLink.replace("wpcd_page_num=" + wpcd_page_num, "wpcd_page_num=" + wpcdPageNum);
}else{
oldLink=oldLink.replace("&wpcd_page_num=" + wpcd_page_num, "");
}}else if(wpcdPageNum){
oldLink=oldLink + "&wpcd_page_num=" + wpcdPageNum;
}}
else if(window.location.href.indexOf('?') > -1&&window.location.href.indexOf('?wpcd_coupon')===-1){
oldLink=window.location.href + oldLink.replace("?", "&");
}
a.attr('href', oldLink);
var theLink=a.attr("data-aff-url");
window.open(a.attr('href'), '_blank');
window.location=theLink;
return false;
};
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n||t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(t,e,n){function o(t,e){for(;t&&t.nodeType!==i;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],2:[function(t,e,n){function o(t,e,n,o,r){var a=i.apply(this,arguments);return t.addEventListener(n,a,r),{destroy:function(){t.removeEventListener(n,a,r)}}}function i(t,e,n,o){return function(n){n.delegateTarget=r(n.target,e),n.delegateTarget&&o.call(t,n)}}var r=t("./closest");e.exports=o},{"./closest":1}],3:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},{}],4:[function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return i(t,e,n);if(c.nodeList(t))return r(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return l(document.body,t,e,n)}var c=t("./is"),l=t("delegate");e.exports=o},{"./is":3,delegate:2}],5:[function(t,e,n){function o(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),i=document.createRange();i.selectNodeContents(t),o.removeAllRanges(),o.addRange(i),e=o.toString()}return e}e.exports=o},{}],6:[function(t,e,n){function o(){}o.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;o<i;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,a=o.length;r<a;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],7:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if(void 0!==o)r(n,e("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),c=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return a(t,[{key:"resolveOptions",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function t(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function t(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function t(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function t(){var e=void 0;try{e=document.execCommand (this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function t(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function t(){this.removeFake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),p=function(t){function e(t,n){r(this,e);var o=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return o.resolveOptions(n),o.listenClick(t),o}return c(e,t),h(e,[{key:"resolveOptions",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenClick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})}},{key:"onClick",value:function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultAction",value:function t(e){return l("action",e)}},{key:"defaultTarget",value:function t(e){var n=l("target",e);if(n)return document.querySelector(n)}},{key:"defaultText",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f<g;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&m<10&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),Math.abs(b)>1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}([0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}([0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&b<0?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});