"use strict";var widgetopts_fe={init:function(){var t=this;t.defaults={topSpacing:0,adminbar:0,elBefore:0,lastPos:0,endFixed:varWidgetOpts.shallNotFixed,margin_top:parseInt(varWidgetOpts.margin_top),disable_width:parseInt(varWidgetOpts.disable_width),disable_height:parseInt(varWidgetOpts.disable_height)},jQuery("#wpadminbar").length>0&&(t.defaults.adminbar=jQuery("#wpadminbar").outerHeight()),jQuery(t.defaults.endFixed).length>0&&(t.defaults.fixBoundary=jQuery(t.defaults.endFixed).offset().top+10),t.bindEvents(),t.clones=t.createSpacer(),t.onScrollHandler(),t.animationHandler(),t.linksHandler(),window.addEventListener("resize",function(){t.onResizeHandler()},!1)},winHeight:function(){return parseInt(jQuery(window).height())},docHeight:function(){return parseInt(jQuery(document).height())},scrollY:function(){return window.pageYOffset||parseInt(jQuery(window).scrollTop())},bindEvents:function(){jQuery("body")},createSpacer:function(){var t,e,i,a,s,n,d,r,o,l={};return jQuery(".widgetopts-fixed-this").length>0&&jQuery(".widgetopts-fixed-this").each(function(p){e=jQuery(this),i=e.parent(),i.hasClass("widgetopts-fixed-this")||(t=e.attr("id"),a=e.position(),s=e.outerHeight(),o=e[0].getBoundingClientRect(),n=o.width,d=parseInt(e.css("margin-bottom")),r=i.attr("data-sticky-spacer"),a.left=o.left,a.top=o.left,a.left<o.left&&e.hasClass("elementor-element")&&(a.left=o.left),a.top<o.left&&e.hasClass("elementor-element")&&(a.top=o.left),"undefined"==typeof t&&(t="widgeopts-holder-"+p,e.attr("id",t)),i.attr("data-sticky-height",0),"undefined"!=typeof r&&r!==!1?i.attr("data-sticky-spacer",parseInt(r)+parseInt(i.attr("data-sticky-handler"))):(i.attr("data-sticky-spacer",0),i.attr("data-sticky-handler",s+d)),l[t]={top:a.top,left:a.left,width:n,height:s,spacing:parseInt(i.attr("data-sticky-spacer")),margin:d},jQuery("<div>",{id:t+"_spacer","class":e.attr("class")+" widgetopts_spacer",css:{display:"none",height:s}}).insertBefore("#"+t),i.hasClass("widgetopts-sticky-parent")||i.addClass("widgetopts-sticky-parent"))}),l},onScrollHandler:function(){function t(){!jQuery.isEmptyObject(r.clones)&&r.defaults.disable_width>0&&window.innerWidth>r.defaults.disable_width&&r.defaults.disable_height>0&&window.innerHeight>r.defaults.disable_height&&(jQuery.each(r.clones,function(t,y){i="#"+t,h[f]=t,a=jQuery(i),n=a.parent(),s=jQuery(i+"_spacer"),d=parseInt(a.css("margin-bottom")),"undefined"==typeof s.offset()||s.offset().top==y.top||s.hasClass("widgetopts_scrolled")||(o+=y.margin,y.top=a.offset().top,y.left=a.offset().left,y.height=a.outerHeight(),y.width=a[0].getBoundingClientRect().width,s.addClass("widgetopts_scrolled"),jQuery(r.defaults.endFixed).length>0&&(r.defaults.fixBoundary=jQuery(r.defaults.endFixed).offset().top)),w+=y.height+y.margin,p=parseInt(n.attr("data-sticky-height")),e=y.top-y.spacing-(r.defaults.adminbar+r.defaults.margin_top),f>0&&(e-=r.clones[h[f-1]].spacing),r.scrollY()>=e?(a.hasClass("widgetopts_stuck")||(p=p+y.height+r.defaults.margin_top,n.attr("data-sticky-height",p)),c=w-(y.height+y.margin),a.addClass("widgetopts_stuck").css({position:"fixed","z-index":90,top:c,left:y.left,width:y.width}),s.show().css({visibility:"hidden"}),f++):r.scrollY()<e&&(a.hasClass("widgetopts_stuck")&&(p=p-y.height-r.defaults.margin_top,n.attr("data-sticky-height",p)),s.hide(),a.removeClass("widgetopts_stuck").css({position:"relative",top:"",left:""})),r.defaults.fixBoundary-p<=r.scrollY()-y.margin+r.defaults.adminbar+d&&(u=r.docHeight()-r.defaults.fixBoundary-r.defaults.margin_top,l=r.docHeight()-(r.scrollY()+p+o),g=w-(y.height+y.margin)+(l-u),a.css({top:g}))}),f=0,w=r.defaults.adminbar+r.defaults.margin_top)}var e,i,a,s,n,d,r=this,o=0,l=0,p=0,u=0,f=0,h=[],c=0,g=0,w=r.defaults.adminbar+r.defaults.margin_top;t(),window.addEventListener("scroll",function(){jQuery(".widgetopts-animate").length>0&&r.animationHandler(),t()})},onResizeHandler:function(){function t(){e.defaults.disable_width>0&&window.innerWidth<e.defaults.disable_width||e.defaults.disable_height>0&&window.innerHeight<e.defaults.disable_height?e.resetFixed():e.resetPosition(),e.resizeTimeout=null}var e=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(t,0)},resetFixed:function(t){jQuery(".widgetopts_spacer").hide(),t||(t=jQuery(".widgetopts-fixed-this")),t.css({position:"relative",top:"",left:"",width:""}).removeClass("widgetopts_stuck")},resetPosition:function(){var t=this;t=this,jQuery(".widgetopts_spacer").remove(),jQuery(".widgetopts-sticky-parent").removeAttr("data-sticky-height data-sticky-spacer data-sticky-handler"),t.resetFixed(),t.clones=t.createSpacer(),t.onScrollHandler()},animationHandler:function(){var t,e,i,a,s,n,d,r=this;jQuery(".widgetopts-animate").each(function(){switch(t=jQuery(this),d=jQuery(this).attr("id"),e=t.attr("data-animation-event"),i=t.attr("data-animation-type"),a=parseFloat(t.attr("data-animation-speed")).toFixed(2),s=parseFloat(t.attr("data-animation-delay")).toFixed(2),n=parseInt(t.attr("data-animation-offset")),t.hasClass("widgetopts-SO")&&"undefined"!=typeof SOWidgetOpts[d]&&"undefined"!=typeof SOWidgetOpts[d].animation&&(i=SOWidgetOpts[d].animation,e=SOWidgetOpts[d].event,a=SOWidgetOpts[d].speed,s=SOWidgetOpts[d].delay,n=SOWidgetOpts[d].offset),a>0&&t.css({"animation-duration":a+"s","-webkit-animation-duration":a+"s"}),s>0&&t.css({"animation-delay":s+"s","-webkit-animation-delay":s+"s"}),isNaN(n)&&(n=0),e){case"onScreen":r.inViewport(t,.7,n)&&!t.hasClass("animated")&&t.addClass("animated "+i);break;case"enters":r.inViewport(t,0,n)&&!t.hasClass("animated")&&t.addClass("animated "+i);break;default:t.hasClass("animated")||t.addClass("animated "+i)}})},linksHandler:function(){var t,e,i,a;jQuery(".widgetopts-SO-linked").length>0&&jQuery(".widgetopts-SO-linked").each(function(){i="",a="",t=jQuery(this),e=jQuery(this).attr("id"),"undefined"!=typeof SOWidgetOptsURL[e]&&("undefined"!=typeof SOWidgetOptsURL[e].targets&&"1"==SOWidgetOptsURL[e].targets&&(i='target="_blank"'),"undefined"!=typeof SOWidgetOptsURL[e].nofollow&&"1"==SOWidgetOptsURL[e].nofollow&&(a='rel="nofollow"'),t.prepend('<a href="'+SOWidgetOptsURL[e].url+'" '+i+" "+a+' class="widgetopts-custom-wlink"></a>'))})},inViewport:function(t,e,i){var a=this,s=a.scrollY(),n=a.winHeight(),i=i||0,d=jQuery(t).height(),r=s+n,o=jQuery(t).offset().top+i,l=o+d,e=e||0;return r>=o+d*e&&l-d*e>=s}};jQuery(window).on("load",function(){widgetopts_fe.init()});