jQuery(document).ready(function($){
AOS.init();
$('.owl-local').owlCarousel({
loop:true,
margin:10,
nav:true,
navText: ['<i class="fas fa-arrow-left"></i>','<i class="fas fa-arrow-right"></i>'],
dots: true,
items:1,
autoplay:true,
autoplayTimeout:6000,
autoplayHoverPause:false,
smartSpeed:3000,
});
$('.owl-attractions-single').owlCarousel({
loop:true,
margin:30,
nav:false,
dots: true,
items:4,
autoplay:false,
autoplayTimeout:3000,
autoplayHoverPause:false,
});
$('.owl-partner-logos').owlCarousel({
loop:true,
margin:30,
nav:false,
dots: false,
items:5,
responsive:{
0:{
items:2,
},
768:{
items:4,
},
1024:{
items:5,
}},
autoplay:false,
autoplayTimeout:5000,
autoplayHoverPause:false,
});
$('.owl-experiences').owlCarousel({
loop:true,
margin:10,
dots: false,
nav:true,
items: 2,
slideBy: 2,
navText: ['<i class="fas fa-arrow-left"></i>','<i class="fas fa-arrow-right"></i>'],
autoplay:true,
autoplayTimeout:3000,
autoplayHoverPause:false,
});
$('.owl-spots').owlCarousel({
loop:true,
margin:30,
nav:false,
dots: true,
responsive:{
0:{
items:2,
},
768:{
items:3,
},
1024:{
items:4,
}},
autoplay:false,
autoplayTimeout:3000,
autoplayHoverPause:false,
});
if(Cookies.get('hide_covid_warning')!="true"){
$(".covid-warning").show();
}
$(".covid-warning .close-covid-warning").on("click", function(){
Cookies.set('hide_covid_warning', 'true');
$(".covid-warning").hide();
});
$('.owl-interest').owlCarousel({
loop:false,
margin:20,
nav:false,
dots:true,
responsive:{
0:{
items:1
},
600:{
items:2
},
1000:{
items:3
}}
});
if($(".owl-interest .article")){
let text_height=[];
$(".owl-interest .article").each(function(i, obj){
text_height.push($(".content-article .text-article", this).height());
let max_array=Math.max.apply(null, text_height);
$(".content-article .text-article", this).css("min-height", max_array);
});
}
if($(".events")){
let text_height=[];
$(".events .row-anual-event").each(function(i, obj){
text_height.push($(".anual_event_content", this).height());
let max_array=Math.max.apply(null, text_height);
$(".anual_event_content", this).css("min-height", max_array);
});
}
let $grid=$('.grid').isotope({
itemSelector: '.element-item',
layoutMode: 'fitRows'
});
$('.filter-button-group').on('click', '.tag span', function(){
let filterValue=$(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
$('.filter-button-group').each(function(i, buttonGroup){
let $buttonGroup=$(buttonGroup);
$buttonGroup.on('click', '.tag span', function(){
$buttonGroup.find('.is-checked').removeClass('is-checked');
$(this).addClass('is-checked');
});
});
$('.filter-button-group .col-tags-filter .wrapper-tags .tag span').each(function(i, buttonGroup){
if($(this).hasClass("is-checked")==true){
$grid.isotope({ filter: $(this).attr("data-filter") });
}});
if($("body").hasClass("post-type-archive-experencia")){
window.addEventListener('scroll',function(){
localStorage.setItem('scrollPosition',window.scrollY);
},false);
window.addEventListener('load',function(){
if(localStorage.getItem('scrollPosition')!==null)
window.scrollTo(0, localStorage.getItem('scrollPosition'));
},false);
}
if($("section").hasClass("plan_your_trip")){
let waypoint=new Waypoint({
element: $(".plan_your_trip"),
handler: function(direction){
if($(".banner .play-toggle i").hasClass("fa-pause-circle")){
$(".banner .play-toggle").trigger("click");
}}
});
}
$(".overlay-menu-mobile ul li").each(function(i, obj){
if($(this).hasClass("menu-item-has-children")){
$(this).append('<div class="wrapper_trigger_menu"><i class="fas fa-chevron-down"></i></div>');
}});
$(".overlay-menu-mobile ul li .wrapper_trigger_menu").on("click", function(){
let parent_item=$(this).parent();
$("> ul", parent_item).toggle();
$(parent_item).toggleClass("active_menu_item");
});
$(".main-navigation .col-menu .menu-mobile-trigger").on("click", function(){
$(".overlay-menu-mobile").addClass("overlay-menu-mobile-active");
$("html").addClass("stop-scroll-mobile-menu-active");
$("body").addClass("stop-scroll-mobile-menu-active");
});
$(".overlay-menu-mobile .wrapper_close_mobile_menu").on("click", function(){
$(".overlay-menu-mobile").removeClass("overlay-menu-mobile-active");
$("html").removeClass("stop-scroll-mobile-menu-active");
$("body").removeClass("stop-scroll-mobile-menu-active");
});
$('[data-youtube]').youtube_background();
$(".search-button").on("click", function(){
$("#searchform").submit();
});
});
!function(){"use strict";function t(t,e){return t.classList?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)}function e(e,i){e.classList?e.classList.add(i):t(e,i)||(e.className+=" "+i)}function i(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("\\b"+e+"\\b","g"),"")}var a=document.createElement("script");a.src="https://www.youtube.com/player_api";var s,o=document.getElementsByTagName("script")[0];function n(t,e,i,a){this.is_mobile=function(){let t=!1;var e;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t}(),this.element=t,this.ytid=i,this.uid=a,this.player=null,this.buttons={},this.state={},this.state.play=!1,this.state.mute=!1,this.params={},this.defaults={pause:!1,"play-button":!1,"mute-button":!1,autoplay:!0,muted:!0,loop:!0,mobile:!1,"load-background":!0,resolution:"16:9",onStatusChange:function(){},"inline-styles":!0,"fit-box":!1,offset:200},this.__init__=function(){this.ytid&&(this.parseProperties(e),this.params.resolution_mod=function(t){var e=t.split(/\s?:\s?/i);if(e.length<2)return 16/9;var i=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(i)||isNaN(a)?16/9:i/a}(this.params.resolution),this.state.playing=this.params.autoplay,this.state.muted=this.params.muted,this.buildHTML(),this.injectIFrame(),this.params["play-button"]&&this.generateActionButton({name:"play",className:"play-toggle",innerHtml:'<i class="fa"></i>',initialState:!1,stateClassName:"paused",condition_parameter:"autoplay",stateChildClassNames:["fa-pause-circle","fa-play-circle"],actions:["play","pause"]}),this.params["mute-button"]&&this.generateActionButton({name:"mute",className:"mute-toggle",innerHtml:'<i class="fa"></i>',initialState:!0,stateClassName:"muted",condition_parameter:"muted",stateChildClassNames:["fa-volume-up","fa-volume-mute"],actions:["unmute","mute"]}))},this.__init__()}function r(t,e){this.elements=t,"string"==typeof t&&(this.elements=document.querySelectorAll(t)),this.index={},this.re={},this.re.YOUTUBE=/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,this.re.VIMEO=/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i,this.__init__=function(){for(var t=0;t<this.elements.length;t++){var i=this.elements[t],a=i.getAttribute("data-youtube"),s=this.getVidID(a);if(s){var o=this.generateUID(s.id);if(o&&"YOUTUBE"===s.type){var r=new n(i,e,s.id,o);this.index[o]=r}}}this.initYTPlayers()},this.__init__()}o.parentNode.insertBefore(a,o),n.prototype.initYTPlayer=function(){var t=this;window.hasOwnProperty("YT")&&(this.player=new YT.Player(this.uid,{events:{onReady:function(e){t.onVideoPlayerReady(e)},onStateChange:function(e){t.onVideoStateChange(e)},onError:function(t){}}}))},n.prototype.onVideoPlayerReady=function(t){this.params.autoplay&&t.target.playVideo()},n.prototype.onVideoStateChange=function(t){0===t.data&&this.params.loop&&t.target.playVideo(),-1===t.data&&this.params.autoplay&&t.target.playVideo(),1===t.data&&(this.iframe.style.opacity=1),this.params.onStatusChange(t)},n.prototype.parseProperties=function(t){if(t)for(var e in this.defaults)t.hasOwnProperty(e)||(this.params[e]=this.defaults[e]);else this.params=this.defaults;for(var e in this.params){var i=this.element.getAttribute("data-ytbg-"+e);null!=i&&(i="false"!==i&&i,this.params[e]=i)}this.params.pause&&(this.params["play-button"]=this.params.pause)},n.prototype.injectIFrame=function(){this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder",0),this.iframe.setAttribute("allow",["autoplay; mute"]);var t="https://www.youtube.com/embed/"+this.ytid+"?enablejsapi=1&disablekb=1&controls=0&rel=0&iv_load_policy=3&cc_load_policy=0&playsinline=1&showinfo=0&modestbranding=1&fs=0&origin="+window.location.origin;if(this.params.muted&&(t+="&mute=1"),this.params.autoplay&&(t+="&autoplay=1"),this.params.loop&&(t+="&loop=1"),this.iframe.src=t,this.uid&&(this.iframe.id=this.uid),this.params["inline-styles"]&&(this.iframe.style.top="50%",this.iframe.style.left="50%",this.iframe.style.transform="translateX(-50%) translateY(-50%)",this.iframe.style.position="absolute",this.iframe.style.opacity=0),this.element.parentNode.appendChild(this.iframe),this.iframe.parentNode.removeChild(this.element),this.params["fit-box"])this.iframe.style.width="100%",this.iframe.style.height="100%";else{var e=this;function i(){var t=e.iframe.parentNode.offsetHeight+e.params.offset,i=e.iframe.parentNode.offsetWidth+e.params.offset,a=e.params.resolution_mod;a>i/t?(e.iframe.style.width=t*a+"px",e.iframe.style.height=t+"px"):(e.iframe.style.width=i+"px",e.iframe.style.height=i/a+"px")}window.addEventListener("resize",i),i()}},n.prototype.buildHTML=function(){var t=this.element.parentNode,e=document.createElement("div");e.className="youtube-background",t.insertBefore(e,this.element),e.appendChild(this.element);var i=this.element.id;this.element.id="",e.id=i;var a={height:"100%",width:"100%","z-index":"0",position:"absolute",overflow:"hidden",top:0,left:0,bottom:0,right:0};if(this.params["mute-button"]||(a["pointer-events"]="none"),this.params["load-background"]&&(a["background-image"]="url(https://img.youtube.com/vi/"+this.ytid+"/maxresdefault.jpg)",a["background-size"]="cover",a["background-repeat"]="no-repeat",a["background-position"]="center"),this.params["inline-styles"]){for(var s in a)e.style[s]=a[s];e.parentNode.style.position="relative"}if(this.is_mobile&&!this.params.mobile)return e;if(this.params["play-button"]||this.params["mute-button"]){var o=document.createElement("div");o.className="video-background-controls",o.style.position="absolute",o.style.top="10px",o.style.right="10px",o.style["z-index"]=2,this.controls_element=o,e.parentNode.appendChild(o)}return e},n.prototype.play=function(){if(this.buttons.hasOwnProperty("play")){var t=this.buttons.play;i(t.element,t.button_properties.stateClassName),e(t.element.firstChild,t.button_properties.stateChildClassNames[0]),i(t.element.firstChild,t.button_properties.stateChildClassNames[1])}this.player&&this.player.playVideo()},n.prototype.pause=function(){if(this.buttons.hasOwnProperty("play")){var t=this.buttons.play;e(t.element,t.button_properties.stateClassName),i(t.element.firstChild,t.button_properties.stateChildClassNames[0]),e(t.element.firstChild,t.button_properties.stateChildClassNames[1])}this.player&&this.player.pauseVideo()},n.prototype.unmute=function(){if(this.buttons.hasOwnProperty("mute")){var t=this.buttons.mute;i(t.element,t.button_properties.stateClassName),e(t.element.firstChild,t.button_properties.stateChildClassNames[0]),i(t.element.firstChild,t.button_properties.stateChildClassNames[1])}this.player&&this.player.unMute()},n.prototype.mute=function(){if(this.buttons.hasOwnProperty("mute")){var t=this.buttons.mute;e(t.element,t.button_properties.stateClassName),i(t.element.firstChild,t.button_properties.stateChildClassNames[0]),e(t.element.firstChild,t.button_properties.stateChildClassNames[1])}this.player&&this.player.mute()},n.prototype.generateActionButton=function(a){var s=document.createElement("button");s.className=a.className,s.innerHTML=a.innerHtml,e(s.firstChild,a.stateChildClassNames[0]),this.params[a.condition_parameter]===a.initialState&&(e(s,a.stateClassName),i(s.firstChild,a.stateChildClassNames[0]),e(s.firstChild,a.stateChildClassNames[1]));var o=this;s.addEventListener("click",(function(e){t(this,a.stateClassName)?(o.state[a.name]=!1,o[a.actions[0]]()):(o.state[a.name]=!0,o[a.actions[1]]())})),this.buttons[a.name]={element:s,button_properties:a},this.controls_element.appendChild(s)},r.prototype.getVidID=function(t){if(null!=t)for(var e in this.re){var i=t.match(this.re[e]);if(i&&i.length)return this.re[e].lastIndex=0,{id:i[1],type:e}}return null},r.prototype.generateUID=function(t){function e(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}for(var i=t+"-"+e(0,9999);this.index.hasOwnProperty(i);)i=t+"-"+e(0,9999);return i},r.prototype.pauseVideos=function(){for(var t in this.index)this.index[t].pause()},r.prototype.playVideos=function(){for(var t in this.index)this.index[t].play()},r.prototype.initYTPlayers=function(t){var e=this;window.onYouTubeIframeAPIReady=function(){for(var i in e.index)e.index[i]instanceof n&&e.index[i].initYTPlayer();t&&setTimeout(t,100)},window.hasOwnProperty("YT")&&window.YT.loaded&&window.onYouTubeIframeAPIReady()},"function"==typeof jQuery&&((s=jQuery).fn.youtube_background=function(t){var e=s(this);return new r(this,t),e}),window.VideoBackgrounds=r}();
jQuery(document).ready(function(t){function e(t,e,a){(n("Facebook Pixel")||n("Conversions API"))&&c(t,e,a,"Facebook"),n("TikTok")&&c(t,e,a,"TikTok"),n("Snapchat"),n("Pinterest")&&c(t,e,a,"Pinterest"),(n("GA3")||n("GA4")||n("Adwords"))&&c(t,e,a,"Google Analytics")}function c(e,c,i,d){var p=i?function(t){for(var e in t)"string"==typeof t[e]&&(t[e]=t[e].replace("{post_id}",fcaPcPost.id).replace("{post_title}",fcaPcPost.title).replace("{post_type}",fcaPcPost.type).replace("{post_category}",fcaPcPost.categories.join(", ")));fcaPcOptions.utm_support&&(t=function(t){for(var e=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],c=0;c<e.length;c++)null!==r(e[c])&&(t[e[c]]=r(e[c]));return t}(t));fcaPcOptions.user_parameters&&(t=function(t){for(var e=["referrer","language","logged_in","post_tag","post_category"],c=0;c<e.length;c++)fcaPcUserParams[e[c]]&&(t[e[c]]=fcaPcUserParams[e[c]]);return t}(t));return t}(i):null;if("undefined"!=typeof fbq){var s=a(),f=o(),l=new Date(t.now()).toUTCString(),u=new Date(l).valueOf()/1e3;if("trackCustom"===e&&"Facebook"===d)fbq(e,c,p,{event_id:s,external_id:f}),n("Conversions API")&&t.ajax({url:fcaPcOptions.ajax_url,type:"POST",data:{action:"fca_pc_capi_event",event_name:c,event_time:u,event_id:s,external_id:f,client_user_agent:navigator.userAgent,event_source_url:window.location.origin+window.location.pathname,custom_data:JSON.stringify(p),nonce:fcaPcOptions.nonce}});else{var _=(g=new Map([["PageView","PageView"],["ViewContent","ViewContent"],["Search","Search"],["AddToCart","AddToCart"],["AddToWishlist","AddToWishlist"],["InitiateCheckout","InitiateCheckout"],["AddPaymentInfo","AddPaymentInfo"],["Purchase","Purchase"],["Lead","Lead"],["CompleteRegistration","CompleteRegistration"]])).get(c);_&&(fbq(e,_,p,{event_id:s,external_id:f}),n("Conversions API")&&t.ajax({url:fcaPcOptions.ajax_url,type:"POST",data:{action:"fca_pc_capi_event",event_name:_,event_time:u,event_id:s,external_id:f,client_user_agent:navigator.userAgent,event_source_url:window.location.origin+window.location.pathname,custom_data:JSON.stringify(p),nonce:fcaPcOptions.nonce}}))}}if("undefined"!=typeof snaptr){var s=a(),f=o(),P=(g=new Map([["PageViewSnapchat","PAGE_VIEW"],["ViewContentSnapchat","VIEW_CONTENT"],["PurchaseSnapchat","PURCHASE"],["AddToCartSnapchat","ADD_CART"],["InitiateCheckoutSnapchat","START_CHECKOUT"],["AddToWishlistSnapchat","ADD_TO_WISHLIST"],["AddPaymentInfoSnapchat","ADD_BILLING"]])).get(c);P&&snaptr(e,P,p,{event_id:s,external_id:f})}if("undefined"!=typeof ttq){var h=(g=new Map([["PageViewTiktok","PageView"],["ViewContentTiktok","ViewContent"],["AddToCartTiktok","AddToCart"],["AddToWishlistTiktok","AddToWishlist"],["InitiateCheckoutTiktok","InitiateCheckout"],["AddPaymentInfoTiktok","AddPaymentInfo"],["PurchaseTiktok","CompletePayment"],["CompleteRegistrationTiktok","CompleteRegistration"]])).get(c);h&&ttq.track(h,p),"trackCustom"===e&&"TikTok"===d&&ttq.track(c,p)}if("undefined"!=typeof pintrk)if("trackCustom"===e&&"Pinterest"===d)pintrk("track",c,p);else{var k=(g=new Map([["AddToCartPinterest","AddToCart"],["PurchasePinterest","Checkout"],["LeadPinterest","Lead"],["ViewContentPinterest","PageVisit"],["CompleteRegistrationPinterest","Signup"]])).get(c);k&&pintrk("track",k,p)}if("undefined"!=typeof gtag){if("track"===e){var g=new Map([["AddToCartGA","add_to_cart"],["AddPaymentInfoGA","add_payment_info"],["AddToWishlistGA","add_to_wishlist"],["PurchaseGA","purchase"],["InitiateCheckoutGA","begin_checkout"],["ViewContentGA","view_item"]]),m=g.get(c);m&&gtag("event",m,p)}"trackCustom"===e&&"Google Analytics"===d&&gtag("event",c,p)}}function a(){return"xxxxxxxxxx".replace(/[x]/g,function(t){return Math.floor(16*Math.random()).toString(16)})}function o(){var t=function(t){for(var e=t+"=",c=document.cookie.split(";"),a=0;a<c.length;a++){for(var o=c[a];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(e))return o.substring(e.length,o.length)}return""}("pixelcat_id");return""==t&&""!=(t=a())&&null!=t&&function(t,e,c){var a=new Date;a.setTime(a.getTime()+24*c*60*60*1e3);var o="expires="+a.toUTCString();document.cookie=t+"="+e+";"+o+";path=/"}("pixelcat_id",t,365),t}function n(t){return-1!==fcaPcOptions.pixel_types.indexOf(t)}function i(t,e){document.cookie=t+"="+e+";path=/"}function d(t){var e=("; "+document.cookie).split("; "+t+"=");return 2===e.length&&e.pop().split(";").shift()}function r(t){for(var e=[],c=location.search.substr(1).split("&"),a=0;a<c.length;a++)if((e=c[a].split("="))[0]===t)return decodeURIComponent(e[1]).replace(/\+/g," ");return null}if(function(){for(var e=0;e<fcaPcEvents.length;e++){var a=fcaPcEvents[e].event,o=fcaPcEvents[e].parameters,n=fcaPcEvents[e].triggerType,i=fcaPcEvents[e].trigger,d=fcaPcEvents[e].apiAction,r=fcaPcEvents[e].pixel_type;switch(n){case"css":t(i).on("click",{name:a,params:o,apiAction:d,pixelType:r},function(t){c(t.data.apiAction,t.data.name,t.data.params,t.data.pixelType)});break;case"hover":t(i).on("mouseenter",{name:a,params:o,apiAction:d,trigger:i,pixelType:r},function(e){c(e.data.apiAction,e.data.name,e.data.params,e.data.pixelType),t(e.data.trigger).off("mouseenter")});break;case"post":fcaPcEvents[e].hasOwnProperty("delay")&&fcaPcEvents[e].hasOwnProperty("scroll")?setTimeout(function(e,a,o,n,i){t(window).scroll({scrollTarget:e,apiAction:a,eventName:o,parameters:n,pixelType:i},function(e){e.data.scrollTarget<=function(){var e=t(window).scrollTop(),c=t(document).height()-t(window).height();return 0==c?100:e/c*100}()&&(t(window).off(e),c(a,o,n,i))}).trigger("scroll")},1e3*fcaPcEvents[e].delay,fcaPcEvents[e].scroll,d,a,o,r):fcaPcEvents[e].hasOwnProperty("delay")?setTimeout(c,1e3*fcaPcEvents[e].delay,d,a,o,r):c(d,a,o,r);break;case"url":t("a").each(function(){t(this).attr("href")===i&&t(this).on("click",{name:a,params:o,apiAction:d,pixelType:r},function(t){c(t.data.apiAction,t.data.name,t.data.params,t.data.pixelType)})})}}}(),fcaPcOptions.debug&&(console.log("pixel cat events:"),console.log(fcaPcEvents),console.log("pixel cat post:"),console.log(fcaPcPost),console.log("pixel cat options:"),console.log(fcaPcOptions)),(n("Facebook Pixel")||n("Conversions API"))&&c("track","PageView"),d("fca_pc_advanced_matching")&&i("fca_pc_advanced_matching",""),"undefined"!=typeof fcaPcSearchQuery&&c("track","Search",fcaPcSearchQuery),fcaPcOptions.woo_enabled&&(fcaPcOptions.debug&&console.log("adding woo events"),t("body").on("added_to_cart",function(){t.ajax({url:fcaPcOptions.ajax_url,type:"POST",data:{action:"fca_pc_woo_ajax_add_to_cart",product_id:fcaPcPost.id},success:function(t){t.success&&((n("Facebook")||n("Conversions API"))&&c("track","AddToCart",t.facebook),n("TikTok")&&c("track","AddToCartTiktok",t.tiktok),n("Snapchat")&&c("track","AddToCartSnapchat",t.snapchat),n("Pinterest")&&c("track","AddToCartPinterest",t.pinterest),(n("GA3")||n("GA4")||n("Adwords"))&&c("track","AddToCartGA",t.ga))}})}),d("fca_pc_woo_add_to_cart")&&(c("track","AddToCart",JSON.parse(decodeURIComponent(d("fca_pc_woo_add_to_cart").replace(/\+/g,"%20")))),i("fca_pc_woo_add_to_cart","")),"undefined"!=typeof fcaPcWooCheckoutCart&&(c("track","InitiateCheckout",fcaPcWooCheckoutCart),t("form.checkout").on("checkout_place_order",function(t){return c("track","AddPaymentInfo",fcaPcWooCheckoutCart),!0})),"undefined"!=typeof fcaPcWooPurchase&&c("track","Purchase",fcaPcWooPurchase),"undefined"!=typeof fcaPcWooProduct&&(fcaPcOptions.woo_delay?setTimeout(c,1e3*fcaPcOptions.woo_delay,"track","ViewContent",fcaPcWooProduct):c("track","ViewContent",fcaPcWooProduct),t(".wl-add-to, .add_to_wishlist").on("click",function(t){c("track","AddToWishlist",fcaPcWooProduct)})),d("fca_pc_woo_add_to_cart_tiktok")&&(c("track","AddToCartTiktok",JSON.parse(decodeURIComponent(d("fca_pc_woo_add_to_cart_tiktok").replace(/\+/g,"%20")))),i("fca_pc_woo_add_to_cart_tiktok","")),"undefined"!=typeof fcaPcWooCheckoutCartTiktok&&(c("track","InitiateCheckoutTiktok",fcaPcWooCheckoutCartTiktok),t("form.checkout").on("checkout_place_order",function(t){return c("track","AddPaymentInfoTiktok",fcaPcWooCheckoutCartTiktok),!0})),"undefined"!=typeof fcaPcWooPurchaseTiktok&&c("track","PurchaseTiktok",fcaPcWooPurchaseTiktok),"undefined"!=typeof fcaPcWooProductTiktok&&(fcaPcOptions.woo_delay?setTimeout(c,1e3*fcaPcOptions.woo_delay,"track","ViewContentTiktok",fcaPcWooProductTiktok):c("track","ViewContentTiktok",fcaPcWooProductTiktok),t(".wl-add-to, .add_to_wishlist").on("click",function(t){c("track","AddToWishlistTiktok",fcaPcWooProductTiktok)})),d("fca_pc_woo_add_to_cart_pinterest")&&(c("track","AddToCartPinterest",JSON.parse(decodeURIComponent(d("fca_pc_woo_add_to_cart_pinterest").replace(/\+/g,"%20")))),i("fca_pc_woo_add_to_cart_pinterest","")),"undefined"!=typeof fcaPcWooPurchasePinterest&&c("track","PurchasePinterest",fcaPcWooPurchasePinterest),"undefined"!=typeof fcaPcWooProductPinterest&&(fcaPcOptions.woo_delay?setTimeout(c,1e3*fcaPcOptions.woo_delay,"track","ViewContentPinterest",fcaPcWooProductPinterest):c("track","ViewContentPinterest",fcaPcWooProductPinterest)),d("fca_pc_woo_add_to_cart_snapchat")&&(c("track","AddToCartSnapchat",JSON.parse(decodeURIComponent(d("fca_pc_woo_add_to_cart_snapchat").replace(/\+/g,"%20")))),i("fca_pc_woo_add_to_cart_snapchat","")),"undefined"!=typeof fcaPcWooCheckoutCartSnapchat&&(c("track","InitiateCheckoutSnapchat",fcaPcWooCheckoutCartSnapchat),t("form.checkout").on("checkout_place_order",function(t){return c("track","AddPaymentInfoSnapchat",fcaPcWooCheckoutCartSnapchat),!0})),"undefined"!=typeof fcaPcWooPurchaseSnapchat&&c("track","PurchaseSnapchat",fcaPcWooPurchaseSnapchat),"undefined"!=typeof fcaPcWooProductSnapchat&&(fcaPcOptions.woo_delay?setTimeout(c,1e3*fcaPcOptions.woo_delay,"track","ViewContentSnapchat",fcaPcWooProductSnapchat):c("track","ViewContentSnapchat",fcaPcWooProductSnapchat),t(".wl-add-to, .add_to_wishlist").on("click",function(t){c("track","AddToWishlistSnapchat",fcaPcWooProductSnapchat)})),d("fca_pc_woo_add_to_cart_ga")&&(c("track","AddToCartGA",JSON.parse(decodeURIComponent(d("fca_pc_woo_add_to_cart_ga").replace(/\+/g,"%20")))),i("fca_pc_woo_add_to_cart_ga","")),"undefined"!=typeof fcaPcWooCheckoutCartGA&&(c("track","InitiateCheckoutGA",fcaPcWooCheckoutCartGA),t("form.checkout").on("checkout_place_order",function(t){return c("track","AddPaymentInfoGA",fcaPcWooCheckoutCartGA),!0})),"undefined"!=typeof fcaPcWooPurchaseGA&&c("track","PurchaseGA",fcaPcWooPurchaseGA),"undefined"!=typeof fcaPcWooProductGA&&(fcaPcOptions.woo_delay?setTimeout(c,1e3*fcaPcOptions.woo_delay,"track","ViewContentGA",fcaPcWooProductGA):c("track","ViewContentGA",fcaPcWooProductGA),t(".wl-add-to, .add_to_wishlist").on("click",function(t){c("track","AddToWishlistGA",fcaPcWooProductGA)}))),fcaPcOptions.edd_enabled&&(fcaPcOptions.debug&&console.log("adding edd events"),t(".edd-add-to-cart").on("click",function(e){if(n("Facebook")||n("Conversions API"))if("undefined"!=typeof fcaPcEddProduct)c("track","AddToCart",fcaPcEddProduct);else{c("track","AddToCart",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,content_name:"Easy Digital Download ID "+t(this).data("download-id"),content_ids:t(this).data("download-id"),content_type:"no"==t(this).data("variable-price")?"product":"product_group"})}if(n("TikTok"))if("undefined"!=typeof fcaPcEddProduct)c("track","AddToCartTiktok",fcaPcEddProductTiktok);else{c("track","AddToCartTiktok",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,content_name:"Easy Digital Download ID "+t(this).data("download-id"),content_ids:t(this).data("download-id"),content_type:"no"==t(this).data("variable-price")?"product":"product_group"})}if(n("GA3")||n("GA4")||n("Adwords"))if("undefined"!=typeof fcaPcEddProductGA)c("track","AddToCartGA",fcaPcEddProductGA);else{c("track","AddToCartGA",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,items:[{item_id:t(this).data("download-id"),item_name:"Easy Digital Download ID "+t(this).data("download-id")}]})}if(n("Pinterest"))if("undefined"!=typeof fcaPcEddProductPinterest)c("track","AddToCartPinterest",fcaPcEddProductPinterest);else{c("track","AddToCartPinterest",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,product_name:"Easy Digital Download ID "+t(this).data("download-id"),product_id:t(this).data("download-id")})}if(n("Snapchat"))if("undefined"!=typeof fcaPcEddProductSnapchat)c("track","AddToCartSnapchat",fcaPcEddProductSnapchat);else{var a={price:t(this).data("price"),currency:fcaPcOptions.edd_currency,description:"Easy Digital Download ID "+t(this).data("download-id"),item_ids:[t(this).data("download-id")]};c("track","AddToCartSnapchat",a)}}),t(".wl-add-to, .add_to_wishlist").on("click",function(e){if(n("Facebook")||n("Conversions API"))if("undefined"!=typeof fcaPcEddProduct)c("track","AddToWishlist",fcaPcEddProduct);else{c("track","AddToWishlist",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,content_name:"Easy Digital Download ID "+t(this).data("download-id"),content_ids:t(this).data("download-id"),content_type:"no"==t(this).data("variable-price")?"product":"product_group"})}if(n("GA3")||n("GA4")||n("Adwords"))if("undefined"!=typeof fcaPcEddProductGA)c("track","AddToWishlistGA",fcaPcEddProductGA);else{c("track","AddToWishlistGA",a={value:t(this).data("price"),currency:fcaPcOptions.edd_currency,items:[{item_id:t(this).data("download-id"),item_name:"Easy Digital Download ID "+t(this).data("download-id")}]})}if(n("TikTok"))if("undefined"!=typeof fcaPcEddProductTiktok)c("track","AddToWishlistTiktok",fcaPcEddProductTiktok);else{c("track","AddToWishlistTiktok",a={price:t(this).data("price"),currency:fcaPcOptions.edd_currency,description:"Easy Digital Download ID "+t(this).data("download-id"),item_ids:[t(this).data("download-id")]})}if(n("Snapchat"))if("undefined"!=typeof fcaPcEddProductSnapchat)c("track","AddToWishlistSnapchat",fcaPcEddProductSnapchat);else{var a={price:t(this).data("price"),currency:fcaPcOptions.edd_currency,description:"Easy Digital Download ID "+t(this).data("download-id"),item_ids:[t(this).data("download-id")]};c("track","AddToWishlistSnapchat",a)}}),"undefined"!=typeof fcaPcEddProduct&&(fcaPcPost.edd_delay?setTimeout(c,1e3*fcaPcPost.edd_delay,"track","ViewContent",fcaPcEddProduct):c("track","ViewContent",fcaPcEddProduct)),"undefined"!=typeof fcaPcEddCheckoutCart&&(c("track","InitiateCheckout",fcaPcEddCheckoutCart),t("#edd_purchase_form").on("submit",function(t){return c("track","AddPaymentInfo",fcaPcEddCheckoutCart),!0})),d("fca_pc_edd_purchase")&&(c("track","Purchase",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase","")),"undefined"!=typeof fcaPcEddCheckoutCartGA&&(c("track","InitiateCheckoutGA",fcaPcEddCheckoutCartGA),t("#edd_purchase_form").on("submit",function(t){return c("track","AddPaymentInfoGA",fcaPcEddCheckoutCartGA),!0})),"undefined"!=typeof fcaPcEddProductGA&&(fcaPcOptions.edd_delay?setTimeout(c,1e3*fcaPcOptions.edd_delay,"track","ViewContent",fcaPcEddProductGA):c("track","ViewContentGA",fcaPcEddProductGA)),d("fca_pc_edd_purchase_ga")&&(c("track","PurchaseGA",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase_ga").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase_ga","")),"undefined"!=typeof fcaPcEddProductTiktok&&(fcaPcPost.edd_delay?setTimeout(c,1e3*fcaPcPost.edd_delay,"track","ViewContentTiktok",fcaPcEddProductTiktok):c("track","ViewContentTiktok",fcaPcEddProductTiktok)),"undefined"!=typeof fcaPcEddCheckoutCartTiktok&&(c("track","InitiateCheckoutTiktok",fcaPcEddCheckoutCartTiktok),t("#edd_purchase_form").on("submit",function(t){return c("track","AddPaymentInfoTiktok",fcaPcEddCheckoutCartTiktok),!0})),d("fca_pc_edd_purchase_tiktok")&&(c("track","PurchaseTiktok",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase_tiktok").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase_tiktok","")),"undefined"!=typeof fcaPcEddCheckoutCartGA&&(c("track","InitiateCheckoutGA",fcaPcEddCheckoutCartGA),t("#edd_purchase_form").on("submit",function(t){return c("track","AddPaymentInfoGA",fcaPcEddCheckoutCartGA),!0})),"undefined"!=typeof fcaPcEddProductGA&&(fcaPcOptions.edd_delay?setTimeout(c,1e3*fcaPcOptions.edd_delay,"track","ViewContent",fcaPcEddProductGA):c("track","ViewContentGA",fcaPcEddProductGA)),d("fca_pc_edd_purchase_ga")&&(c("track","PurchaseGA",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase_ga").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase_ga","")),"undefined"!=typeof fcaPcEddProductPinterest&&(fcaPcOptions.edd_delay?setTimeout(c,1e3*fcaPcOptions.edd_delay,"track","ViewContentPinterest",fcaPcEddProductPinterest):c("track","ViewContentPinterest",fcaPcEddProductPinterest)),d("fca_pc_edd_purchase_pinterest")&&(c("track","PurchasePinterest",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase_pinterest").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase_pinterest","")),"undefined"!=typeof fcaPcEddCheckoutCartSnapchat&&(c("track","InitiateCheckoutSnapchat",fcaPcEddCheckoutCartSnapchat),t("#edd_purchase_form").on("submit",function(t){return c("track","AddPaymentInfoSnapchat",fcaPcEddCheckoutCartSnapchat),!0})),"undefined"!=typeof fcaPcEddProductSnapchat&&(fcaPcOptions.edd_delay?setTimeout(c,1e3*fcaPcOptions.edd_delay,"track","ViewContentSnapchat",fcaPcEddProductSnapchat):c("track","ViewContentSnapchat",fcaPcEddProductSnapchat)),d("fca_pc_edd_purchase_snapchat")&&(c("track","PurchaseSnapchat",JSON.parse(decodeURIComponent(d("fca_pc_edd_purchase_snapchat").replace(/\+/g,"%20")))),i("fca_pc_edd_purchase_snapchat",""))),"undefined"!=typeof fcaPcVideos&&(fcaPcVideos.forEach(function(t){t.on("pixel_event",function(t,e,a){c(t,e,a)})}),fcaPcOptions.debug&&(console.log("fcaPcVideos:"),console.log(fcaPcVideos))),"undefined"!=typeof fcaPcLandingPageCatEnabled&&t("#fca-lpc-optin-button").on("click",function(e){var a;if(a=!(0!==t("#fca-lpc-gdpr-consent").length)||"checked"===t("#fca-lpc-gdpr-consent").attr("checked"),t("#fca-lpc-email-input").val()){t("#fca-lpc-email-input").val(),t("#fca-lpc-name-input").val();if(a)return c("track","Lead",{content_name:fcaPcPost.title}),!0}}),"undefined"!=typeof fcaPcOptinCatEnabled&&t(".fca_eoi_form").submit(function(e){var a=!0,o=t(this).find('input[name="name"]').val(),n=t(this).find('input[name="email"]').val();t(this).find('input[name="i_agree"]').length&&"checked"!==t(this).find(".fca_eoi_gdpr_consent").attr("checked")&&(a=!1),n&&a&&c("track","Lead",{content_name:fcaPcPost.title,form_id:t(this).find("#fca_eoi_form_id").val()})}),"undefined"!=typeof fcaPcEptEnabled&&t(".ptp-checkout-button, .ptp-button, .fca-ept-button").on("click",function(e){-1!==t(this).attr("href").indexOf("?edd_action=add_to_cart&download_id")&&fcaPcOptions.edd_enabled||-1!==t(this).attr("href").indexOf("add-to-cart=")&&fcaPcOptions.woo_enabled||c("track","InitiateCheckout",{content_name:fcaPcPost.title,pricing_table_id:function(t){var e=[];if(t.closest(".ptp-pricing-table").length)e=t.closest(".ptp-pricing-table");else if(t.closest(".pricing_container").length)e=t.closest(".pricing_container");else if(t.closest(".ptp-stylish-pricingtable").length)e=t.closest(".ptp-stylish-pricingtable");else if(t.closest(".ptp-design4-pricingtable").length)e=t.closest(".ptp-design4-pricingtable");else if(t.closest(".ptp-dg5-pricing-table").length)e=t.closest(".ptp-dg5-pricing-table");else if(t.closest(".cd-pricing-container").length)e=t.closest(".cd-pricing-container");else if(t.closest(".ptp-comparison1-pricingtable").length)e=t.closest(".ptp-comparison1-pricingtable");else if(t.closest(".ptp-comparison2-pricingtable").length)e=t.closest(".ptp-comparison2-pricingtable");else if(t.closest(".ptp-comparison3-pricingtable").length)e=t.closest(".ptp-comparison3-pricingtable");else if(t.closest(".fca-ept-main").length)return(e=t.closest(".fca-ept-main")).attr("id").replace("fca-ept-table-","");return e.length?e.attr("id").replace("ptp-",""):""}(t(this)),plan_name:function(t){var e=[];return t.closest(".ptp-col").find(".ptp-plan").length?e=t.closest(".ptp-col").find(".ptp-plan"):t.closest(".pricing_item").find(".name").length?e=t.closest(".pricing_item").find(".name"):t.closest(".ptp-stylish-column").find(".title").length?e=t.closest(".ptp-stylish-column").find(".title"):t.closest(".ptp-design4-col").find(".ptp-design4-title").length?e=t.closest(".ptp-design4-col").find(".ptp-design4-title").eq(0):t.closest(".ptp-dg5-col").find(".ptp-dg5-plan").length?e=t.closest(".ptp-dg5-col").find(".ptp-dg5-plan"):t.closest(".ptp-dg6-col").find(".ptp-dg6-pricing-header h2").length?e=t.closest(".ptp-dg6-col").find(".ptp-dg6-pricing-header h2"):t.closest(".ptp-dg7-col").find(".ptp-dg7-pricing-header h2").length?e=t.closest(".ptp-dg7-col").find(".ptp-dg7-pricing-header h2"):t.closest(".ptp-price-table").find(".ptp-plan-title h2").length?e=t.closest(".ptp-price-table").find(".ptp-plan-title h2"):t.closest(".ptp-cp2-price-table").find(".ptp-cp2-plan-title h2").length?e=t.closest(".ptp-cp2-price-table").find(".ptp-cp2-plan-title h2"):t.closest(".ptp-cp3-price-table").find(".ptp-cp3-plan-title h2").length?e=t.closest(".ptp-cp3-price-table").find(".ptp-cp3-plan-title h2"):t.closest(".fca-ept-column").find(".fca-ept-plan").length&&(e=t.closest(".fca-ept-column").find(".fca-ept-plan")),e.length?e.text():""}(t(this)),price:function(t){var e=[];return t.closest(".ptp-col").find(".ptp-price").length?e=t.closest(".ptp-col").find(".ptp-price"):t.closest(".pricing_item").find(".price").length?e=t.closest(".pricing_item").find(".price"):t.closest(".ptp-stylish-column").find(".price").length?e=t.closest(".ptp-stylish-column").find(".price"):t.closest(".ptp-design4-col").find(".ptp-design4-price").length?e=t.closest(".ptp-design4-col").find(".ptp-design4-price"):t.closest(".ptp-dg5-col").find(".ptp-dg5-price").length?e=t.closest(".ptp-dg5-col").find(".ptp-dg5-price"):t.closest(".ptp-dg6-col").find(".ptp-dg6-price").length?e=t.closest(".ptp-dg6-col").find(".ptp-dg6-price"):t.closest(".ptp-dg7-col").find(".ptp-dg7-price").length?e=t.closest(".ptp-dg7-col").find(".ptp-dg7-price"):t.closest(".ptp-price-table").find(".cp1-ptp-price").length?e=t.closest(".ptp-price-table").find(".cp1-ptp-price"):t.closest(".ptp-cp2-price-table").find(".ptp-cp2-row-id-0").length?e=t.closest(".ptp-cp2-price-table").find(".ptp-cp2-row-id-0"):t.closest(".ptp-cp3-price-table").find(".cp3-ptp-price").length?e=t.closest(".ptp-cp3-price-table").find(".cp3-ptp-price"):t.closest(".fca-ept-column").find(".fca-ept-price").length&&(e=t.closest(".fca-ept-column").find(".fca-ept-price")),e.length?Number(e.text().replace(/[^0-9\.]+/g,"")):""}(t(this))})}),"undefined"!=typeof fcaPcQuizCatEnabled){t(".fca_qc_start_button").on("click",function(c){return e("trackCustom","QuizStart",{quiz_id:parseInt(t(this).closest(".fca_qc_quiz").prop("id").replace("fca_qc_quiz_","")),quiz_name:t(this).closest(".fca_qc_quiz").find(".fca_qc_quiz_title").text()}),!0}),t(".fca_qc_share_link").on("click",function(c){return e("trackCustom","QuizShare",{quiz_id:parseInt(t(this).closest(".fca_qc_quiz").prop("id").replace("fca_qc_quiz_","")),quiz_name:t(this).closest(".fca_qc_quiz").find(".fca_qc_quiz_title").text()}),!0}),t(".fca_qc_submit_email_button").on("click",function(e){var a;if(a=!(0!==t(".fca-qc-gdpr-consent").length)||"checked"===t(".fca-qc-gdpr-consent").attr("checked"),t(this).siblings("#fca_qc_email_input").val()){var o=parseInt(t(this).closest(".fca_qc_quiz").prop("id").replace("fca_qc_quiz_","")),n=t(this).closest(".fca_qc_quiz").find(".fca_qc_quiz_title").text();t(this).siblings("#fca_qc_email_input").val(),t(this).siblings("#fca_qc_name_input").val();if(a)return c("track","Lead",{quiz_id:o,quiz_name:n}),!0}});var p=new MutationObserver(function(c,a){var o=t(c[0].target);e("trackCustom","QuizCompletion",{quiz_id:parseInt(o.closest(".fca_qc_quiz").prop("id").replace("fca_qc_quiz_","")),quiz_name:o.closest(".fca_qc_quiz").find(".fca_qc_quiz_title").text(),quiz_result:o.text()}),a.disconnect()});t(".fca_qc_score_title").each(function(){p.observe(this,{attributes:!0,childList:!0})})}});
if(typeof fcaPcOptions==='object'&&fcaPcOptions.video_enabled){
class EventEmitter {
constructor(){
this.events={}}
on(event, listener){
if(typeof this.events[event]!=='object'){
this.events[event]=[]
}
this.events[event].push(listener)
return ()=> this.removeListener(event, listener)
}
removeListener(event, listener){
if(typeof this.events[event]==='object'){
const idx=this.events[event].indexOf(listener)
if(idx > -1){
this.events[event].splice(idx, 1)
}}
}
emit(event, ...args){
if(typeof this.events[event]==='object'){
this.events[event].forEach(listener=> listener.apply(this, args))
}}
once(event, listener){
const remove=this.on(event, (...args)=> {
remove()
listener.apply(this, args)
})
}}
class FCA_PC_Video extends EventEmitter {
constructor(selector){
super()
this.video_ready=false
if(typeof selector===undefined){
return
}
this.element=selector
this.init()
}
init(){
this.setup_events()
this.type=this.video_type()
this.load_api()
}
load_api(){
switch (this.type){
case 'YOUTUBE':
this.api_youtube_load()
break
case 'WISTIA':
this.api_wistia_load()
break
case 'VIMEO':
this.api_vimeo_load()
break
}}
setup_events(){
this.on('api_youtube_loaded', this.api_youtube_setup)
this.on('api_vimeo_loaded', this.api_vimeo_setup)
this.on('api_wistia_loaded', this.api_wistia_setup)
}
video_type(){
let src=this.element.attr('src')
if(src===''){
this.revoke('pixel cat video: video link not found.')
return false
}
if(src.indexOf('youtube.com') > -1) return 'YOUTUBE'
if(src.indexOf('vimeo.com') > -1) return 'VIMEO'
if(src.indexOf('fast.wistia.com') > -1) return 'WISTIA'
}
revoke(message){
if(fcaPcOptions.debug){
console.log(message)
console.log('pixel cat video: revoked ')
}}
api_vimeo_load(){
jQuery.getScript('https://player.vimeo.com/api/player.js', ()=> {
this.emit('api_vimeo_loaded')
})
}
api_vimeo_setup(){
let player_dom=this.element[0]
try {
this.api=new Vimeo.Player(player_dom)
this.api.ready().then(()=> {
this.api_vimeo_ready()
})
} catch(e){
if(fcaPcOptions.debug)
console.log(e.message)
return
}}
api_vimeo_ready(){
if(fcaPcOptions.debug){
console.log('Pixel Cat video: Vimeo video ready')
}
this.video_ready=true
this.api.getVideoId().then(id=> {
this.video_id=id
})
this.api.getVideoTitle().then(title=> {
this.title=title
})
this.api.getVideoUrl().then(url=> {
this.url=url
})
this.api.getDuration().then(duration=> {
this.duration=duration
})
this.events_triggered={}
this.api_vimeo_state_change()
}
api_vimeo_state_change(){
this.api.on('play', event=> {
this.trigger_event('VideoPlay')
this.timer=setInterval(this.track_progress.bind(this), 1000)
})
this.api.on('pause', event=> {
this.trigger_event('VideoPause', { percentage_watched: this.percentage_watched() + '%' })
clearInterval(this.timer)
})
this.api.on('ended', event=> {
this.trigger_event('VideoWatchToEnd')
clearInterval(this.timer)
})
}
api_wistia_load(){
jQuery.getScript('//fast.wistia.net/assets/external/E-v1.js', ()=> {
this.emit('api_wistia_loaded')
})
}
api_wistia_setup(){
let player_dom=this.element
let video_src=player_dom.attr('src')
if(typeof video_src==='undefined'){
return
}
const pattern=/(https:\/\/fast\.wistia\.com\/embed\/medias)\/(.*)\.jsonp/
let match=video_src.match(pattern)
if(match===null){
if(fcaPcOptions.debug){
console.log('no video id match')
}
return
}
this.url=match[1]
let video_id=match[2]
if(typeof video_id==='undefined'){
if(fcaPcOptions.debug){
console.log('pixel cat video: wistia video_id not found.')
}
return
}
window._wq=window._wq||[]
this.api=window._wq
this.api.push({
id: video_id,
onReady: this.api_wistia_ready.bind(this)
})
}
api_wistia_ready(video){
if(fcaPcOptions.debug){
console.log('pixel cat video: wistia video ready.')
}
this.video_ready=true
this.api=video
this.video_id=video.data.media.hashedId
this.title=video.data.media.name!==undefined ? video.data.media.name:'Untitled'
this.url=this.url + '/' + this.video_id
this.events_triggered={}
this.api_wistia_state_change.bind(this)()
}
api_wistia_state_change(){
this.api.bind('play', event=> {
this.trigger_event('VideoPlay')
})
this.api.bind('pause', event=> {
this.trigger_event('VideoPause', { percentage_watched: this.percentage_watched() + '%' })
})
this.api.bind('percentwatchedchanged',(percent, lastPercent)=> {
this.track_progress()
})
this.api.bind('end', event=> {
this.trigger_event('VideoWatchToEnd')
})
}
api_youtube_load(){
this.load_async_script('https://www.youtube.com/iframe_api')
}
api_youtube_setup(){
let player_dom=this.element[0]
this.api=new YT.Player(player_dom, {
events: {
'onReady': this.api_youtube_ready.bind(this),
'onStateChange': this.api_youtube_state_change.bind(this)
}})
}
api_youtube_ready(event){
if(fcaPcOptions.debug){
console.log('pixel cat video: youtube video ready')
}
this.video_ready=true
this.data=this.api.getVideoData()
this.video_id=this.data.video_id
this.title=this.data.title
this.url=this.api.getVideoUrl()
this.events_triggered={}}
api_youtube_state_change(event){
if(fcaPcOptions.debug){
console.log(event)
}
switch(event.data){
case 0:
this.trigger_event('VideoWatchToEnd')
clearInterval(this.timer)
break
case 1:
this.trigger_event('VideoPlay')
this.timer=setInterval(this.track_progress.bind(this), 1000)
break
case 2:
this.trigger_event('VideoPause',  { percentage_watched: this.percentage_watched() + '%' })
clearInterval(this.timer)
break
}}
video_youtube_end(){
if(fcaPcOptions.debug){
console.log('end')
}}
load_async_script(url){
let new_script=document.createElement('script')
let first_script=document.getElementsByTagName('script')[0]
new_script.src=url
first_script.parentNode.insertBefore(new_script, first_script)
if(fcaPcOptions.debug){
console.log('pixel cat video: ' + url + ' has been loaded.')
}}
track_progress(){
switch(this.video_type()){
case 'YOUTUBE':
case 'VIMEO':
case 'WISTIA':
this.video_track_progress()
break
}}
video_track_progress(){
let percent=this.percentage_watched()
if(fcaPcOptions.debug){
console.log(this.percentage_watched())
}
switch(true){
case(percent >=10&&percent < 25):
this.trigger_event('VideoWatch10Percent')
break
case(percent >=25&&percent < 50):
this.trigger_event('VideoWatch25Percent')
break
case(percent >=50&&percent < 75):
this.trigger_event('VideoWatch50Percent')
break
case(percent >=75&&percent < 90):
this.trigger_event('VideoWatch75Percent')
break
case(percent >=90&&percent < 100):
this.trigger_event('VideoWatch90Percent')
break
}}
video_params(){
return {
video_title: this.title,
video_url: this.url,
video_id: this.video_id
}}
percentage_watched(){
switch(this.type){
case 'YOUTUBE':
return  Math.round(this.api.getCurrentTime() / this.api.getDuration() * 100)
case 'VIMEO':
this.api.getCurrentTime().then(current_time=> {
this.current_time=current_time
})
return  Math.round(this.current_time / this.duration * 100)
case 'WISTIA':
return Math.round(this.api.time() / this.api.duration() * 100)
default:
return false
}}
trigger_event(action, additional_params={}){
if(this.events_triggered[action]){
return
}
let params=Object.assign({}, this.video_params(), additional_params)
this.emit('pixel_event', 'trackCustom', action, params)
if(action!=='VideoPause'){
this.events_triggered[action]=true
}}
}
FCA_PC_Video.prototype.__proto__=EventEmitter.prototype;
function onYouTubeIframeAPIReady(){
fcaPcVideos.forEach(video=> {
if(video.type!=='YOUTUBE'){
return
}
video.emit('api_youtube_loaded')
})
}
window.fcaPcVideos=[];
function detect_videos(){
let videos=[];
jQuery('iframe').each(function (){
var char=jQuery(this)[0].src.includes('?') ? '&':'?'
jQuery(this)[0].src=jQuery(this)[0].src + char + 'enablejsapi=1'
videos.push(jQuery(this))
})
jQuery('script').each(function (){
let src=jQuery(this).attr('src')
if(typeof src==='undefined'){
return
}
if(src.indexOf('https://fast.wistia.com/embed/medias/')===-1){
return
}
videos.push(jQuery(this))
})
if(videos.length===0){
if(fcaPcOptions.debug){
console.log('No videos detected')
}
return
}
videos.forEach(function (video){
window.fcaPcVideos.push(new FCA_PC_Video(video))
})
}
detect_videos()
};