!function(o){var i=0,e=9999;o.widget("wp.pointer",{options:{pointerClass:"wp-pointer",pointerWidth:320,content:function(){return o(this).text()},buttons:function(t,i){return o('<a class="close" href="#"></a>').text(wp.i18n.__("Dismiss")).on("click.pointer",function(t){t.preventDefault(),i.element.pointer("close")})},position:"top",show:function(t,i){i.pointer.show(),i.opened()},hide:function(t,i){i.pointer.hide(),i.closed()},document:document},_create:function(){var t;this.content=o('<div class="wp-pointer-content"></div>'),this.arrow=o('<div class="wp-pointer-arrow"><div class="wp-pointer-arrow-inner"></div></div>'),t="absolute",this.element.parents().add(this.element).filter(function(){return"fixed"===o(this).css("position")}).length&&(t="fixed"),this.pointer=o("<div />").append(this.content).append(this.arrow).attr("id","wp-pointer-"+i++).addClass(this.options.pointerClass).css({position:t,width:this.options.pointerWidth+"px",display:"none"}).appendTo(this.options.document.body)},_setOption:function(t,i){var e=this.options,n=this.pointer;"document"===t&&i!==e.document?n.detach().appendTo(i.body):"pointerClass"===t&&n.removeClass(e.pointerClass).addClass(i),o.Widget.prototype._setOption.apply(this,arguments),"position"===t?this.reposition():"content"===t&&this.active&&this.update()},destroy:function(){this.pointer.remove(),o.Widget.prototype.destroy.call(this)},widget:function(){return this.pointer},update:function(i){var e=this,t=this.options,n=o.Deferred();if(!t.disabled)return n.done(function(t){e._update(i,t)}),(t="string"==typeof t.content?t.content:t.content.call(this.element[0],n.resolve,i,this._handoff()))&&n.resolve(t),n.promise()},_update:function(t,i){var e=this.options;i&&(this.pointer.stop(),this.content.html(i),(i=e.buttons.call(this.element[0],t,this._handoff()))&&i.wrap('<div class="wp-pointer-buttons" />').parent().appendTo(this.content),this.reposition())},reposition:function(){var t;this.options.disabled||(t=this._processPosition(this.options.position),this.pointer.css({top:0,left:0,zIndex:e++}).show().position(o.extend({of:this.element,collision:"fit none"},t)),this.repoint())},repoint:function(){var t=this.options;t.disabled||(t="string"==typeof t.position?t.position:t.position.edge,this.pointer[0].className=this.pointer[0].className.replace(/wp-pointer-[^\s'"]*/,""),this.pointer.addClass("wp-pointer-"+t))},_processPosition:function(t){var i={top:"bottom",bottom:"top",left:"right",right:"left"},t="string"==typeof t?{edge:t+""}:o.extend({},t);return t.edge&&("top"==t.edge||"bottom"==t.edge?(t.align=t.align||"left",t.at=t.at||t.align+" "+i[t.edge],t.my=t.my||t.align+" "+t.edge):(t.align=t.align||"top",t.at=t.at||i[t.edge]+" "+t.align,t.my=t.my||t.edge+" "+t.align)),t},open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||this.update().done(function(){i._open(t)})},_open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||(this.active=!0,this._trigger("open",t,this._handoff()),this._trigger("show",t,this._handoff({opened:function(){i._trigger("opened",t,i._handoff())}})))},close:function(t){var i;this.active&&!this.options.disabled&&((i=this).active=!1,this._trigger("close",t,this._handoff()),this._trigger("hide",t,this._handoff({closed:function(){i._trigger("closed",t,i._handoff())}})))},sendToTop:function(){this.active&&this.pointer.css("z-index",e++)},toggle:function(t){this.pointer.is(":hidden")?this.open(t):this.close(t)},_handoff:function(t){return o.extend({pointer:this.pointer,element:this.element},t)}})}(jQuery);
(function($){var zindex=9999;$.widget('aal.aalPointer',$.wp.pointer,{reposition:function(){var position;if(this.options.disabled){return}
position=this._processPosition(this.options.position);this.pointer.css({top:0,left:0,zIndex:zindex++});this.pointer.fadeIn(this.options.fadeIn);var _optionsPosition=$.extend({of:this.element,collision:'fit none'},position);this.pointer.position(_optionsPosition);this.repoint()},_create:function(){this._super();if(this.options.pointerHeight){this.pointer.css({height:this.options.pointerHeight+'px'})}}})}(jQuery));
(function($){$(document).ready(function(){initialize('.amazon-disclaimer-tooltip')});$('body').on('aal_ajax_loaded_unit',function(event){initialize($(event.target).find('.amazon-disclaimer-tooltip'))});function initialize(target){var _this=$(target)
$(_this).find('.amazon-disclaimer-tooltip-content-text').css('display','none');var _pointerTooltip=$(_this);_pointerTooltip.on('mouseover',function(){$(this).aalPointer({pointerClass:'aal-tooltip',pointerWidth:340,content:function(){return $(this).find('.amazon-disclaimer-tooltip-content-text').html()},position:{edge:'bottom',align:'center',within:$(this).closest('.amazon-product-container, .amazon-auto-links'),collision:'fit none',},buttons:function(){},close:function(){},}).aalPointer('open');var _self=this;$(this).add('.aal-tooltip').on('mouseleave',function(){var _selfMouseLeave=this;var _timeoutId=setTimeout(function(){$(_self).aalPointer('close');$(_self).off('mouseleave');$(_selfMouseLeave).off('mouseleave');$(_self).off('mouseenter');$(_selfMouseLeave).off('mouseenter')},650);$(_self).data('timeoutId',_timeoutId)});$(this).add('.aal-tooltip').on('mouseenter',function(){clearTimeout($(_self).data('timeoutId'))})})}}(jQuery));
(function($){var imageSize=420;$(document).ready(function(){setMainThumbnailDataAttributes($('body'));initialize('.amazon-auto-links-product-image img[data-large-src]')});$('body').on('aal_ajax_loaded_unit',function(event){setMainThumbnailDataAttributes(event.target);initialize($(event.target).find('.amazon-auto-links-product-image img[data-large-src]'))});function setMainThumbnailDataAttributes(target){$(target).find('.amazon-product-thumbnail-container[data-large-src]').each(function(){$(this).find('.amazon-product-thumbnail img').attr('data-large-src',$(this).attr('data-large-src')).attr('data-href',$(this).attr('data-href'))})}
function initialize(target){var _imagePreviewPopup=$(target);_imagePreviewPopup.on('click',function(){return!1});_imagePreviewPopup.on('mouseover',function(){var _srcImg=$(this).data('largeSrc');if(!_srcImg){return}
var _container=$(this).closest('.amazon-product-container, .amazon-auto-links'),_body=$('body');var _maxSize=Math.min(_body.width(),_body.height());_maxSize=_maxSize<imageSize?(_maxSize*0.8):imageSize;$('.aal-image-preview-tooltip').trigger('aalPointer:close');$(this).aalPointer({pointerClass:'aal-image-preview-tooltip',pointerWidth:parseInt(_maxSize),pointerHeight:parseInt(_maxSize),content:function(){return"<a href='"+$(this).data('href')+"' target='_blank'><img src='"+$(this).data('largeSrc')+"' alt='thumbnail' /></a>"},position:{edge:'bottom',align:'center',within:_container,collision:'fit',},fadeIn:300,buttons:function(){},close:function(){},show:function(event,t){t.pointer.fadeIn(300);t.opened()},hide:function(event,t){t.pointer.fadeOut(300);t.closed()},});var _self=this;var img=new Image();img.onload=function(){var _pointer=$(_self).aalPointer('widget');if(this.width>this.height){_pointer.css('height','')}else{var _heightBody=_body.height();if(_heightBody<this.height+24){_pointer.css('height',(_heightBody*0.80)+'px')}
_pointer.css('width','')}
$(_self).aalPointer('open')};img.alt='';img.src=_srcImg;$(this).add('.aal-image-preview-tooltip').on('mouseleave aalPointer:close',function(event){var _selfMouseLeave=this;if('mouseleave'===event.type){var _timeoutId=setTimeout(_closeTooltip,200);$(_self).data('timeoutId',_timeoutId)}
if('aalPointer:close'===event.type){_closeTooltip()}
function _closeTooltip(){$(_self).aalPointer('close');$(_self).off('mouseleave');$(_selfMouseLeave).off('mouseleave');$(_self).off('mouseenter');$(_selfMouseLeave).off('mouseenter')}});$(this).add('.aal-image-preview-tooltip').on('mouseenter',function(){clearTimeout($(_self).data('timeoutId'))})})}}(jQuery));