!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../data","../plugin","../safe-active-element","../safe-blur","../scroll-parent","../version","../widget"],t):t(jQuery)}(function(P){"use strict";return P.widget("ui.draggable",P.ui.mouse,{version:"1.13.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<P(t.target).closest(".ui-resizable-handle").length||(this.handle=this._getHandle(t),!this.handle)||(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=P(this);return P("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=P.ui.safeActiveElement(this.document[0]);P(t.target).closest(e).length||P.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),P.ui.ddmanager&&(P.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===P(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),P.ui.ddmanager&&!e.dropBehaviour&&P.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),P.ui.ddmanager&&P.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new P.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",P.ui.ddmanager&&P.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,s=!1;return P.ui.ddmanager&&!this.options.dropBehaviour&&(s=P.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,s)?P(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),P.ui.ddmanager&&P.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),P.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new P.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!P(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,s="function"==typeof e.helper,t=s?P(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),s&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&P.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){var t,e;return"relative"!==this.cssPosition?{top:0,left:0}:(t=this.element.position(),e=this._isRootNode(this.scrollParent[0]),{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())})},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e=this.options,s=this.document[0];this.relativeContainer=null,e.containment?"window"===e.containment?this.containment=[P(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,P(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,P(window).scrollLeft()+P(window).width()-this.helperProportions.width-this.margins.left,P(window).scrollTop()+(P(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:"document"===e.containment?this.containment=[0,0,P(s).width()-this.helperProportions.width-this.margins.left,(P(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:e.containment.constructor===Array?this.containment=e.containment:("parent"===e.containment&&(e.containment=this.helper[0].parentNode),(e=(s=P(e.containment))[0])&&(t=/(scroll|auto)/.test(s.css("overflow")),this.containment=[(parseInt(s.css("borderLeftWidth"),10)||0)+(parseInt(s.css("paddingLeft"),10)||0),(parseInt(s.css("borderTopWidth"),10)||0)+(parseInt(s.css("paddingTop"),10)||0),(t?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(s.css("borderRightWidth"),10)||0)-(parseInt(s.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(s.css("borderBottomWidth"),10)||0)-(parseInt(s.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=s)):this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var t="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*t+this.offset.parent.top*t-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*t,left:e.left+this.offset.relative.left*t+this.offset.parent.left*t-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*t}},_generatePosition:function(t,e){var s,i=this.options,o=this._isRootNode(this.scrollParent[0]),n=t.pageX,r=t.pageY;return o&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),{top:(r=e&&(this.containment&&(s=this.relativeContainer?(e=this.relativeContainer.offset(),[this.containment[0]+e.left,this.containment[1]+e.top,this.containment[2]+e.left,this.containment[3]+e.top]):this.containment,t.pageX-this.offset.click.left<s[0]&&(n=s[0]+this.offset.click.left),t.pageY-this.offset.click.top<s[1]&&(r=s[1]+this.offset.click.top),t.pageX-this.offset.click.left>s[2]&&(n=s[2]+this.offset.click.left),t.pageY-this.offset.click.top>s[3])&&(r=s[3]+this.offset.click.top),i.grid&&(e=i.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1]:this.originalPageY,r=!s||e-this.offset.click.top>=s[1]||e-this.offset.click.top>s[3]?e:e-this.offset.click.top>=s[1]?e-i.grid[1]:e+i.grid[1],t=i.grid[0]?this.originalPageX+Math.round((n-this.originalPageX)/i.grid[0])*i.grid[0]:this.originalPageX,n=!s||t-this.offset.click.left>=s[0]||t-this.offset.click.left>s[2]?t:t-this.offset.click.left>=s[0]?t-i.grid[0]:t+i.grid[0]),"y"===i.axis&&(n=this.originalPageX),"x"===i.axis)?this.originalPageY:r)-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,s){return s=s||this._uiHash(),P.ui.plugin.call(this,t,[e,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),P.Widget.prototype._trigger.call(this,t,e,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),P.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,s){var i=P.extend({},t,{item:s.element});s.sortables=[],P(s.options.connectToSortable).each(function(){var t=P(this).sortable("instance");t&&!t.options.disabled&&(s.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,i))})},stop:function(e,t,s){var i=P.extend({},t,{item:s.element});s.cancelHelperRemoval=!1,P.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,i))})},drag:function(s,i,o){P.each(o.sortables,function(){var t=!1,e=this;e.positionAbs=o.positionAbs,e.helperProportions=o.helperProportions,e.offset.click=o.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,P.each(o.sortables,function(){return this.positionAbs=o.positionAbs,this.helperProportions=o.helperProportions,this.offset.click=o.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&P.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,o._parent=i.helper.parent(),e.currentItem=i.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return i.helper[0]},s.target=e.currentItem[0],e._mouseCapture(s,!0),e._mouseStart(s,!0,!0),e.offset.click.top=o.offset.click.top,e.offset.click.left=o.offset.click.left,e.offset.parent.left-=o.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=o.offset.parent.top-e.offset.parent.top,o._trigger("toSortable",s),o.dropped=e.element,P.each(o.sortables,function(){this.refreshPositions()}),o.currentItem=o.element,e.fromOutside=o),e.currentItem&&(e._mouseDrag(s),i.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",s,e._uiHash(e)),e._mouseStop(s,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),i.helper.appendTo(o._parent),o._refreshOffsets(s),i.position=o._generatePosition(s,!0),o._trigger("fromSortable",s),o.dropped=!1,P.each(o.sortables,function(){this.refreshPositions()}))})}}),P.ui.plugin.add("draggable","cursor",{start:function(t,e,s){var i=P("body"),s=s.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,e,s){s=s.options;s._cursor&&P("body").css("cursor",s._cursor)}}),P.ui.plugin.add("draggable","opacity",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("opacity")&&(s._opacity=e.css("opacity")),e.css("opacity",s.opacity)},stop:function(t,e,s){s=s.options;s._opacity&&P(e.helper).css("opacity",s._opacity)}}),P.ui.plugin.add("draggable","scroll",{start:function(t,e,s){s.scrollParentNotHidden||(s.scrollParentNotHidden=s.helper.scrollParent(!1)),s.scrollParentNotHidden[0]!==s.document[0]&&"HTML"!==s.scrollParentNotHidden[0].tagName&&(s.overflowOffset=s.scrollParentNotHidden.offset())},drag:function(t,e,s){var i=s.options,o=!1,n=s.scrollParentNotHidden[0],r=s.document[0];n!==r&&"HTML"!==n.tagName?(i.axis&&"x"===i.axis||(s.overflowOffset.top+n.offsetHeight-t.pageY<i.scrollSensitivity?n.scrollTop=o=n.scrollTop+i.scrollSpeed:t.pageY-s.overflowOffset.top<i.scrollSensitivity&&(n.scrollTop=o=n.scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(s.overflowOffset.left+n.offsetWidth-t.pageX<i.scrollSensitivity?n.scrollLeft=o=n.scrollLeft+i.scrollSpeed:t.pageX-s.overflowOffset.left<i.scrollSensitivity&&(n.scrollLeft=o=n.scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-P(r).scrollTop()<i.scrollSensitivity?o=P(r).scrollTop(P(r).scrollTop()-i.scrollSpeed):P(window).height()-(t.pageY-P(r).scrollTop())<i.scrollSensitivity&&(o=P(r).scrollTop(P(r).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-P(r).scrollLeft()<i.scrollSensitivity?o=P(r).scrollLeft(P(r).scrollLeft()-i.scrollSpeed):P(window).width()-(t.pageX-P(r).scrollLeft())<i.scrollSensitivity&&(o=P(r).scrollLeft(P(r).scrollLeft()+i.scrollSpeed)))),!1!==o&&P.ui.ddmanager&&!i.dropBehaviour&&P.ui.ddmanager.prepareOffsets(s,t)}}),P.ui.plugin.add("draggable","snap",{start:function(t,e,s){var i=s.options;s.snapElements=[],P(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=P(this),e=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,s){for(var i,o,n,r,l,a,h,p,c,f=s.options,d=f.snapTolerance,g=e.offset.left,u=g+s.helperProportions.width,m=e.offset.top,v=m+s.helperProportions.height,_=s.snapElements.length-1;0<=_;_--)a=(l=s.snapElements[_].left-s.margins.left)+s.snapElements[_].width,p=(h=s.snapElements[_].top-s.margins.top)+s.snapElements[_].height,u<l-d||a+d<g||v<h-d||p+d<m||!P.contains(s.snapElements[_].item.ownerDocument,s.snapElements[_].item)?(s.snapElements[_].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=!1):("inner"!==f.snapMode&&(i=Math.abs(h-v)<=d,o=Math.abs(p-m)<=d,n=Math.abs(l-u)<=d,r=Math.abs(a-g)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h-s.helperProportions.height,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a}).left),c=i||o||n||r,"outer"!==f.snapMode&&(i=Math.abs(h-m)<=d,o=Math.abs(p-v)<=d,n=Math.abs(l-g)<=d,r=Math.abs(a-u)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p-s.helperProportions.height,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a-s.helperProportions.width}).left),!s.snapElements[_].snapping&&(i||o||n||r||c)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=i||o||n||r||c)}}),P.ui.plugin.add("draggable","stack",{start:function(t,e,s){var i,s=s.options,s=P.makeArray(P(s.stack)).sort(function(t,e){return(parseInt(P(t).css("zIndex"),10)||0)-(parseInt(P(e).css("zIndex"),10)||0)});s.length&&(i=parseInt(P(s[0]).css("zIndex"),10)||0,P(s).each(function(t){P(this).css("zIndex",i+t)}),this.css("zIndex",i+s.length))}}),P.ui.plugin.add("draggable","zIndex",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("zIndex")&&(s._zIndex=e.css("zIndex")),e.css("zIndex",s.zIndex)},stop:function(t,e,s){s=s.options;s._zIndex&&P(e.helper).css("zIndex",s._zIndex)}}),P.ui.draggable});
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f)}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown")};c._touchMove=function(f){if(!a){return}this._touchMoved=true;d(f,"mousemove")};c._touchEnd=function(f){if(!a){return}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click")}a=false};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f)}})(jQuery);
jQuery(document).ready(function($){
var isCartPage=xoo_wsc_params.isCart=='1',
isCheckoutPage=xoo_wsc_params.isCheckout=='1';
var get_wcurl=function(endpoint){
return xoo_wsc_params.wc_ajax_url.toString().replace('%%endpoint%%',
endpoint
);
};
var markupTimeout=null;
class Notice{
constructor($modal){
this.$modal=$modal;
this.timeout=null;
}
add(notice, type='success', clearPrevious=true){
var $noticeCont=this.$modal.find('.xoo-wsc-notice-container');
if(clearPrevious){
$noticeCont.html('');
}
var noticeHTML=type==='success' ? xoo_wsc_params.html.successNotice.toString().replace('%s%', notice):xoo_wsc_params.html.errorNotice.toString().replace('%s%', notice);
$noticeCont.html(noticeHTML);
}
showNotification(){
Notice.showMarkupNotice();
var $noticeCont=this.$modal.find('.xoo-wsc-notice-container');
if(!$noticeCont.length||$noticeCont.children().length===0) return;
$noticeCont.slideDown();
clearTimeout(this.timeout);
this.timeout=setTimeout(function(){
$noticeCont.slideUp('slow',function(){
});
},xoo_wsc_params.notificationTime)
}
hideNotification(){
this.$modal.find('.xoo-wsc-notice-container').hide();
}
static hideMarkupNotice(){
Notice.$noticeContainer().removeClass('xoo-wsc-active');
}
static $noticeContainer(){
return $('.xoo-wsc-markup-notices')
}
static showMarkupNotice(){
if(cart.isOpen()) return;
var $markupNotice=Notice.$noticeContainer();
var $notices=$markupNotice.find('.xoo-wsc-notice-container .xoo-wsc-notices');
if(!$notices.length||$notices.children().length===0) return;
setTimeout(function(){$markupNotice.addClass('xoo-wsc-active')},10);
clearTimeout(markupTimeout);
markupTimeout=setTimeout(function(){
$markupNotice.removeClass('xoo-wsc-active');
},xoo_wsc_params.notificationTime)
}}
class Container{
constructor($modal, container){
this.$modal=$modal;
this.container=container||'cart';
this.notice=new Notice(this.$modal);
}
isOpen(){
return this.$modal.hasClass('xoo-wsc-'+this.container+'-active');
}
eventHandlers(){
$(document.body).on('wc_fragments_refreshed updated_checkout', this.onCartUpdate.bind(this));
}
onCartUpdate(){
this.unblock();
this.notice.showNotification();
}
setAjaxData(data, noticeSection){
var ajaxData={
container: this.container,
noticeSection: noticeSection||this.noticeSection||this.container,
isCheckout: isCheckoutPage,
isCart: isCartPage
}
if(typeof data==='object'){
$.extend(ajaxData, data);
}else{
var serializedData=data;
$.each(ajaxData, function(key, value){
serializedData +=('&'+key+'='+value);
})
ajaxData=serializedData;
}
return ajaxData;
}
toggle(type){
var $activeEls=this.$modal.add('body').add('html'),
activeClass='xoo-wsc-'+ this.container +'-active';
if(type==='show'){
$activeEls.addClass(activeClass);
}
else if(type==='hide'){
$activeEls.removeClass(activeClass);
}else{
$activeEls.toggleClass(activeClass);
}
$(document.body).trigger('xoo_wsc_' + this.container + '_toggled', [ type ]);
this.notice.hideNotification();
}
block(){
this.$modal.addClass('xoo-wsc-loading');
}
unblock(){
this.$modal.removeClass('xoo-wsc-loading');
}
refreshMyFragments(){
if(xoo_wsc_params.refreshCart==="yes"&&typeof wc_cart_fragments_params!=='undefined'){
$(document.body).trigger('wc_fragment_refresh');
return;
}
this.block();
$.ajax({
url: get_wcurl('xoo_wsc_refresh_fragments'),
type: 'POST',
context: this,
data: {},
success: function(response){
this.updateFragments(response);
},
complete: function(){
this.unblock();
}})
}
updateCartCheckoutPage(){
if(isCheckoutPage){
if($('form.checkout').length===0){
location.reload();
return;
}
$(document.body).trigger("update_checkout");
}
if(isCartPage){
$(document.body).trigger("wc_update_cart");
}}
updateFragments(response){
console.log('updated');
if(response.fragments){
$(document.body).trigger('xoo_wsc_before_loading_fragments', [ response ]);
this.block();
$.each(response.fragments, function(key, value){
$(key).replaceWith(value);
});
if(typeof wc_cart_fragments_params!=='undefined'&&('sessionStorage' in window&&window.sessionStorage!==null) ){
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(response.fragments) );
localStorage.setItem(wc_cart_fragments_params.cart_hash_key, response.cart_hash);
sessionStorage.setItem(wc_cart_fragments_params.cart_hash_key, response.cart_hash);
if(response.cart_hash){
sessionStorage.setItem('wc_cart_created',(new Date()).getTime());
}}
$(document.body).trigger('wc_fragments_refreshed');
this.unblock();
}
if(xoo_wsc_params.refreshCart==="yes"&&typeof wc_cart_fragments_params!=='undefined'){
this.block();
$(document.body).trigger('wc_fragment_refresh');
return;
}}
}
class Cart extends Container{
constructor($modal){
super($modal, 'cart');
this.refreshFragmentsOnPageLoad();
this.eventHandlers();
}
refreshFragmentsOnPageLoad(){
setTimeout(function(){
this.refreshMyFragments();
}.bind(this), xoo_wsc_params.fetchDelay)
}
eventHandlers(){
super.eventHandlers();
this.$modal.on('click', '.xoo-wsc-smr-del', this.deleteIconClick.bind(this));
this.$modal.on('click', '.xoo-wsch-close, .xoo-wsc-opac, .xoo-wsc-cart-close', this.closeCartOnClick.bind(this));
this.$modal.on('click', '.xoo-wsc-basket', this.toggleCart.bind(this));
$(document.body).on('xoo_wsc_cart_updated', this.updateCartCheckoutPage.bind(this));
$(document.body).on('click', 'a.added_to_cart, .xoo-wsc-cart-trigger', this.openCart.bind(this));
$(document.body).on('added_to_cart', this.addedToCart.bind(this));
$(document.body).on('wc-blocks_added_to_cart', this.blockAddedToCart.bind(this));
if(xoo_wsc_params.autoOpenCart==='yes'&&xoo_wsc_params.addedToCart==='yes'){
this.openCart();
}
if(xoo_wsc_params.ajaxAddToCart==='yes'){
$(document.body).on('submit', 'form.cart', this.addToCartFormSubmit.bind(this));
}
if(typeof wc_cart_fragments_params==='undefined'){
$(window).on('pageshow' , this.onPageShow.bind(this));
}
if(xoo_wsc_params.triggerClass){
$(document.body).on('click', '.'+xoo_wsc_params.triggerClass, this.openCart.bind(this));
}
if(isCheckoutPage||isCartPage){
$(document.body).on('updated_shipping_method', this.refreshMyFragments.bind(this));
}
this.initMasonryLayout();
}
toggleCart(e){
if(this.isOpen()){
this.closeCartOnClick(e);
}else{
this.openCart(e);
}}
openCart(e){
if(e){
e.preventDefault();
e.stopImmediatePropagation();
}
this.toggle('show');
Notice.hideMarkupNotice();
}
addToCartFormSubmit(e){
var $form=$(e.currentTarget);
if($form.closest('.product').hasClass('product-type-external')||$form.siblings('.xoo-wsc-disable-atc').length) return;
var $button=e.originalEvent&&e.originalEvent.submitter ? $(e.originalEvent.submitter):$form.find('button[type="submit"]'),
formData=new FormData($form.get(0)),
productData=$form.serializeArray(),
hasProductId=false;
$.each(productData, function(key, form_item){
if(form_item.name==='productID'||form_item.name==='add-to-cart'){
if(form_item.value){
hasProductId=true;
return false;
}}
})
if(!hasProductId&&$form.attr('action')){
var is_url=$form.attr('action').match(/add-to-cart=([0-9]+)/),
productID=is_url ? is_url[1]:false;
}
if($button.attr('name')&&$button.attr('value')){
formData.append($button.attr('name'), $button.attr('value'));
}
if(productID){
formData.append('add-to-cart', productID);
}
formData.append('action', 'xoo_wsc_add_to_cart');
var doAjaxAddToCart=true;
$.each(xoo_wsc_params.skipAjaxForData, function(key, value){
if(formData.has(key)&&(!value||formData.get(key)==value) ){
doAjaxAddToCart=false;
return false;
}})
if(doAjaxAddToCart){
e.preventDefault();
this.addToCartAjax($button, formData);
}}
addToCartAjax($button, formData){
this.block();
$button.addClass('loading');
$(document.body).trigger('adding_to_cart', [ $button, formData ]);
$.ajax({
url: get_wcurl('xoo_wsc_add_to_cart'),
type: 'POST',
context: this,
cache: false,
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response.fragments){
$(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash, $button ]);
}else if(response.error){
Notice.$noticeContainer().replaceWith(response.notice);
Notice.showMarkupNotice();
}else{
window.location.reload();
}},
complete: function(){
this.unblock();
$button
.removeClass('loading')
.addClass('added');
}})
}
addedToCart(e, response, hash, $button){
this.updateFragments({ fragments: response });
this.onCartUpdate();
var _this=this;
if(xoo_wsc_params.autoOpenCart==="yes"){
setTimeout(function(){
_this.openCart();
},20)
}}
blockAddedToCart(){
$(document.body).trigger('wc_fragment_refresh');
this.block();
var _this=this;
if(xoo_wsc_params.autoOpenCart==="yes"){
setTimeout(function(){
_this.openCart();
},20)
}}
closeCartOnClick(e){
e.preventDefault();
this.toggle('hide');
}
onPageShow(e){
if(e.originalEvent.persisted){
this.refreshMyFragments();
$(document.body).trigger('wc_fragment_refresh');
}}
deleteIconClick(e){
this.updateItemQty($(e.currentTarget).parents('.xoo-wsc-product').data('key'), 0);
}
updateItemQty(cart_key, qty){
if(!cart_key||qty===undefined) return;
this.block();
var formData={
cart_key: cart_key,
qty: qty
}
$.ajax({
url: get_wcurl('xoo_wsc_update_item_quantity'),
type: 'POST',
context: this,
data: this.setAjaxData(formData),
success: function(response){
this.updateFragments(response);
$(document.body).trigger('xoo_wsc_quantity_updated', [response]);
$(document.body).trigger('xoo_wsc_cart_updated', [response]);
this.unblock();
}})
}
onCartUpdate(){
super.onCartUpdate();
this.toggleBasket();
this.initMasonryLayout();
}
initMasonryLayout(){
if(xoo_wsc_params.productLayout!=='cards') return;
$('.xoo-wsc-products.xoo-wsc-pattern-card').masonry({
itemSelector: '.xoo-wsc-product-cont',
columnWidth: '.xoo-wsc-product-cont', 
percentPosition: true
});
}
toggleBasket(){
var $basket=$('.xoo-wsc-basket'),
show=xoo_wsc_params.showBasket,
hasProducts=this.$modal.find('.xoo-wsc-product').length;
if(show==="always_show"){
$basket.show();
}
else if(show==="hide_empty"){
if(hasProducts){
$basket.show();
}else{
$basket.hide();
}}else{
$basket.hide();
}
var $shortcode=$('.xoo-wsc-sc-cont');
if($shortcode.length&&xoo_wsc_params.menuCartHideOnEmpty.length){
var shortcodeEls=xoo_wsc_params.shortcodeEls;
$.each(xoo_wsc_params.menuCartHideOnEmpty, function(index, val){
if(shortcodeEls[val]){
if(hasProducts){
$(shortcodeEls[val]).show();
}else{
$(shortcodeEls[val]).hide();
}}
})
}}
}
var cart=new Cart($('.xoo-wsc-modal'));
var AnimateCard={
type: xoo_wsc_params.cardAnimate.type,
duration: xoo_wsc_params.cardAnimate.duration,
init: function(){
var onEvent=xoo_wsc_params.cardAnimate.event==='back_hover' ? 'mouseenter':'click';
$('body').on(onEvent, '.xoo-wsc-has-back', this.animate);
$('body').on('mouseleave', '.xoo-wsc-has-back', this.reverseAnimate);
},
animate: function(e){
if(e.target.classList.contains('xoo-wsc-smr-del')) return;
var $img=$(this).find('.xoo-wsc-img-col');
if(!$img.hasClass('xoo-wsc-caniming')){
e.preventDefault();
}else{
return;
}
$img.attr('data-exclasses', $img.attr('class'));
$img.removeClass()
$img.addClass($img.attr('data-exclasses'));
$img.addClass('xoo-wsc-caniming' + ' ' + AnimateCard.type);
},
reverseAnimate: function(){
var $img=$(this).find('.xoo-wsc-img-col');
if(!$img.hasClass('xoo-wsc-caniming') ) return;
$img.addClass(AnimateCard.type+'Return');
AnimateCard.clear=setTimeout(function(){
$img.removeClass().addClass($img.attr('data-exclasses'));
}, AnimateCard.duration * 1000);
}}
if(xoo_wsc_params.cardAnimate.enable==="yes"){
AnimateCard.init();
}});
jQuery(document).ready(function($){jQuery(document.body).on('updated_cart_totals wc_cart_emptied removed_from_cart added_to_cart',function(){$.ajax({method:'GET',url:seopressAjaxAnalytics.seopress_analytics,data:{action:'seopress_after_update_cart',_ajax_nonce:seopressAjaxAnalytics.seopress_nonce,},success:function(data){jQuery('body').append(data.data)},})})});
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=115)}({115:function(e,t,n){"use strict";n.r(t);var r=function(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var o=function(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var i=function(e,t){return function(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,l=e[t];if(o(n)&&r(i))if("function"==typeof a)if("number"==typeof s){var c={callback:a,priority:s,namespace:i};if(l[n]){var u,d=l[n].handlers;for(u=d.length;u>0&&!(s>=d[u-1].priority);u--);u===d.length?d[u]=c:d.splice(u,0,c),l.__current.forEach((function(e){e.name===n&&e.currentIndex>=u&&e.currentIndex++}))}else l[n]={handlers:[c],runs:0};"hookAdded"!==n&&e.doAction("hookAdded",n,i,a,s)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}};var a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,a){var s=e[t];if(o(i)&&(n||r(a))){if(!s[i])return 0;var l=0;if(n)l=s[i].handlers.length,s[i]={runs:s[i].runs,handlers:[]};else for(var c=s[i].handlers,u=function(e){c[e].namespace===a&&(c.splice(e,1),l++,s.__current.forEach((function(t){t.name===i&&t.currentIndex>=e&&t.currentIndex--})))},d=c.length-1;d>=0;d--)u(d);return"hookRemoved"!==i&&e.doAction("hookRemoved",i,a),l}}};var s=function(e,t){return function(n,r){var o=e[t];return void 0!==r?n in o&&o[n].handlers.some((function(e){return e.namespace===r})):n in o}};var l=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r){var o=e[t];o[r]||(o[r]={handlers:[],runs:0}),o[r].runs++;var i=o[r].handlers;for(var a=arguments.length,s=new Array(a>1?a-1:0),l=1;l<a;l++)s[l-1]=arguments[l];if(!i||!i.length)return n?s[0]:void 0;var c={name:r,currentIndex:0};for(o.__current.push(c);c.currentIndex<i.length;){var u=i[c.currentIndex],d=u.callback.apply(null,s);n&&(s[0]=d),c.currentIndex++}return o.__current.pop(),n?s[0]:void 0}};var c=function(e,t){return function(){var n,r,o=e[t];return null!==(n=null===(r=o.__current[o.__current.length-1])||void 0===r?void 0:r.name)&&void 0!==n?n:null}};var u=function(e,t){return function(n){var r=e[t];return void 0===n?void 0!==r.__current[0]:!!r.__current[0]&&n===r.__current[0].name}};var d=function(e,t){return function(n){var r=e[t];if(o(n))return r[n]&&r[n].runs?r[n].runs:0}},f=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=i(this,"actions"),this.addFilter=i(this,"filters"),this.removeAction=a(this,"actions"),this.removeFilter=a(this,"filters"),this.hasAction=s(this,"actions"),this.hasFilter=s(this,"filters"),this.removeAllActions=a(this,"actions",!0),this.removeAllFilters=a(this,"filters",!0),this.doAction=l(this,"actions"),this.applyFilters=l(this,"filters",!0),this.currentAction=c(this,"actions"),this.currentFilter=c(this,"filters"),this.doingAction=u(this,"actions"),this.doingFilter=u(this,"filters"),this.didAction=d(this,"actions"),this.didFilter=d(this,"filters")};var h=function(){return new f},p=h();p.addAction,p.addFilter,p.removeAction,p.removeFilter,p.hasAction,p.hasFilter,p.removeAllActions,p.removeAllFilters,p.doAction,p.applyFilters,p.currentAction,p.currentFilter,p.doingAction,p.doingFilter,p.didAction,p.didFilter,p.actions,p.filters;function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){g(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=v(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==v(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}window.isEditMode=!1,window.eael=window.ea={hooks:h(),isEditMode:!1,elementStatusCheck:function(e){return!(!window.eaElementList||!(e in window.eaElementList))||(window.eaElementList=y(y({},window.eaElementList),{},g({},e,!0)),!1)},debounce:function(e,t){var n;return function(){var r=this,o=arguments;clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}}},eael.hooks.addAction("widgets.reinit","ea",(function(e){var t=jQuery(".eael-filter-gallery-container",e),n=jQuery(".eael-post-grid:not(.eael-post-carousel)",e),r=jQuery(".eael-twitter-feed-masonry",e),o=jQuery(".eael-instafeed",e),i=jQuery(".premium-gallery-container",e),a=jQuery(".eael-event-calendar-cls",e),s=jQuery(".eael-testimonial-slider",e),l=jQuery(".eael-tm-carousel",e),c=jQuery(".eael-post-carousel:not(.eael-post-grid)",e),u=jQuery(".eael-logo-carousel",e),d=jQuery(".eael-twitter-feed-carousel",e);t.length&&t.isotope("layout"),n.length&&n.isotope("layout"),r.length&&r.isotope("layout"),o.length&&o.isotope("layout"),i.length&&i.isotope("layout"),a.length&&eael.hooks.doAction("eventCalendar.reinit"),s.length&&eael.hooks.doAction("testimonialSlider.reinit"),l.length&&eael.hooks.doAction("teamMemberCarousel.reinit"),c.length&&eael.hooks.doAction("postCarousel.reinit"),u.length&&eael.hooks.doAction("logoCarousel.reinit"),d.length&&eael.hooks.doAction("twitterCarousel.reinit")}));var w,b=function(e){void 0===window.eaelPreventResizeOnClick&&window.dispatchEvent(new Event("resize")),(e="object"===v(e)?e:jQuery(e)).find(".swiper-wrapper").each((function(){var e=jQuery(this).css("transform");jQuery(this).css("transform",e)}))};eael.hooks.addAction("ea-advanced-tabs-triggered","ea",b),eael.hooks.addAction("ea-advanced-accordion-triggered","ea",b),jQuery(window).on("elementor/frontend/init",(function(){window.isEditMode=elementorFrontend.isEditMode(),window.eael.isEditMode=elementorFrontend.isEditMode(),eael.hooks.doAction("init"),eael.isEditMode&&eael.hooks.doAction("editMode.init")})),function(e){eael.getToken=function(){localize.nonce&&!eael.noncegenerated&&e.ajax({url:localize.ajaxurl,type:"post",data:{action:"eael_get_token"},success:function(e){e.success&&(localize.nonce=e.data.nonce,eael.noncegenerated=!0)}})},eael.sanitizeURL=function(e){if(e.startsWith("/")||e.startsWith("#"))return e;try{var t=new URL(e);if(!["http:","https:","ftp:","ftps:","mailto:","news:","irc:","irc6:","ircs:","gopher:","nntp:","feed:","telnet:","mms:","rtsp:","sms:","svn:","tel:","fax:","xmpp:","webcal:","urn:"].includes(t.protocol))throw new Error("Invalid protocol");return t.toString()}catch(e){return console.error("Error sanitizing URL:",e.message),"#"}};var t=!0;window.addEventListener("hashchange",(function(){if(t){var n=window.location.hash.substr(1);"undefined"!==(n="safari"===n?"eael-safari":n)&&n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)&&e("#"+n).trigger("click")}})),e("a").on("click",(function(n){var r,o=e(this).attr("href");(r=(o=void 0===o?"":o).startsWith("#"))||(r=(o=o.replace(localize.page_permalink,"")).startsWith("#")),r&&(t=!1,setTimeout((function(){t=!0}),100));try{if(o.startsWith("#!")){var i=o.replace("#!","#");e(i).trigger("click")}else if(r&&(e(o).hasClass("eael-tab-item-trigger")||e(o).hasClass("eael-accordion-header"))&&(e(o).trigger("click"),void 0!==o&&o)){var a=e(o).closest(".eael-advance-tabs");if(a.length>0){var s=a.data("custom-id-offset");s=s?parseFloat(s):0,e("html, body").animate({scrollTop:e(o).offset().top-s},300)}}}catch(e){}})),e(document).on("click",".e-n-tab-title",(function(){setTimeout((function(){window.dispatchEvent(new Event("resize"))}),100)}))}(jQuery),(w=jQuery)(document).on("click",".theme-savoy .eael-product-popup .nm-qty-minus, .theme-savoy .eael-product-popup .nm-qty-plus",(function(e){var t=w(this),n=t.closest(".quantity").find(".qty"),r=parseFloat(n.val()),o=parseFloat(n.attr("max")),i=parseFloat(n.attr("min")),a=n.attr("step");r&&""!==r&&"NaN"!==r||(r=0),""!==o&&"NaN"!==o||(o=""),""!==i&&"NaN"!==i||(i=0),"any"!==a&&""!==a&&void 0!==a&&"NaN"!==parseFloat(a)||(a=1),t.hasClass("nm-qty-plus")?o&&(o==r||r>o)?n.val(o):n.val(r+parseFloat(a)):i&&(i==r||r<i)?n.val(i):r>0&&n.val(r-parseFloat(a))})),function(e){e.fn.isInViewport=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;if(e(this).length<1)return!1;var n=e(this).offset().top,r=n+e(this).outerHeight()/t,o=e(window).scrollTop(),i=o+e(window).height()/t;return r>o&&n<i},e(document).ready((function(){var e=new URLSearchParams(location.search);if(e.has("popup-selector")&&(e.has("eael-lostpassword")||e.has("eael-resetpassword"))){var t=e.get("popup-selector");t.length&&/^[A-Za-z.#][A-Za-z0-9_:.#\s-]*$/.test(t)&&(t=t.replace(/_/g," "),setTimeout((function(){jQuery(t).trigger("click")}),300))}})),e(document).on("click",".eael-onpage-edit-template",(function(){var t=e(this),n=t.data("eael-template-id"),r=t.data("page-id"),o=t.data("mode");"edit"===o?(parent.window.$e.internal("panel/state-loading"),parent.window.$e.run("editor/documents/switch",{id:parseInt(n)}).then((function(){t.data("mode","save"),t.find("span").text("Save & Back"),t.find("i").addClass("eicon-arrow-left").removeClass("eicon-edit"),t.closest(".eael-onpage-edit-template-wrapper").addClass("eael-onpage-edit-activate").parent().addClass("eael-widget-otea-active"),parent.window.$e.internal("panel/state-ready")}))):"save"===o&&(parent.window.$e.internal("panel/state-loading"),parent.window.$e.run("editor/documents/switch",{id:parseInt(r),mode:"save",shouldScroll:!1}).then((function(){parent.window.$e.internal("panel/state-ready"),t.data("mode","edit")})))}))}(jQuery)}});
jQuery(document).ready(function ($){
var variable_id=jQuery('[name="product_id"]').val();
var available_ids=[];
var variable_bulk_table="";
function get_table(product_id, updateBulkTable=false){
if(typeof jQuery('.wdp_bulk_table_content').attr('data-available-ids')!=='undefined'){
available_ids=JSON.parse(jQuery('.wdp_bulk_table_content').attr('data-available-ids'));
}
if(available_ids.indexOf(parseInt(product_id))===-1){
return;
}
if(product_id===variable_id&&variable_bulk_table&&!updateBulkTable){
jQuery('.wdp_bulk_table_content').html(variable_bulk_table)
return true;
}
let attributes={};
jQuery('form.variations_form[data-product_id=' + variable_id + '] select').each(function (index, item){
if(jQuery(item).attr("data-attribute_name")){
attributes[jQuery(item).attr("data-attribute_name")]=jQuery(this).val();
}});
var data={
action: 'get_table_with_product_bulk_table',
product_id: parseInt(product_id),
attributes: attributes,
...jQuery('form.cart').triggerHandler('wdp_get_custom_data')
};
return jQuery.ajax({
url: script_data.ajaxurl,
data: data,
dataType: 'json',
type: 'POST',
success: function (response){
if(response.success){
jQuery('.wdp_bulk_table_content').each(function (_, item){
let jQItem=jQuery(item);
let availableIds=JSON.parse(jQItem.attr('data-available-ids'));
if(availableIds.indexOf(parseInt(product_id))===-1){
return;
}
jQItem.html(jQuery(response.data).children()).trigger('update');
});
init_custom_event();
if(product_id===variable_id){
variable_bulk_table=response.data;
}}else{
get_table(variable_id);
}},
error: function (response){
get_table(variable_id);
}});
}
function init_custom_event(){
jQuery('.wdp_bulk_table_content').on('get_table', function (e, $obj_id){
if(typeof $obj_id==='undefined'||!$obj_id){
get_table(variable_id);
}else{
get_table($obj_id);
}});
}
function init_events(){
if(jQuery('.wdp_bulk_table_content').length > 0){
jQuery('.variations_form').on('found_variation', { variationForm: this },
function (event, variation){
if(typeof variation==='undefined'){
get_table(variable_id);
return true;
}
get_table(variation.variation_id);
return true;
})
.on('click', '.reset_variations',
{ variationForm: this },
function (event, variation){
get_table(variable_id);
return true;
})
.on('reset_data',
function (event){
get_table(variable_id);
return true;
});
jQuery('form.cart').on('adp_found_variation', function (e, { product_id, variation_id}){
get_table(variation_id||product_id, true);
return true;
});
init_custom_event();
}}
if(script_data.js_init_trigger){
$(document).on(script_data.js_init_trigger, function (){
init_events();
});
}
jQuery('form.cart').on('adp_variations_form', function(){
init_events();
});
setTimeout(function (){
jQuery('.variations_form').on("wc_variation_form", function (){
init_events();
})
}, 0);
function watchForQuickView(){
let observer=new MutationObserver(function (mutations){
mutations.forEach(function (mutation){
mutation.addedNodes.forEach(function (node){
if($(node).hasClass('product-lightbox-inner')||$(node).find('.product-lightbox-inner').length){
init_events();
}});
});
});
observer.observe(document.body, { childList: true, subtree: true });
}
watchForQuickView();
});