Descripción
'};var V=function(t,e){for(var i=new URL(t),n=new URLSearchParams(i.search),o=new URLSearchParams,a=0,s=[].concat(m(n),m(Object.entries(e)));a\n Sorry, your browser doesn\'t support embedded videos.',format:""}},G=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onInit","onReady","onCreateSlide","onRemoveSlide","onSelectSlide","onUnselectSlide","onRefresh","onMessage"];i0?"svembed":"embed"),i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src="//maps.google.".concat(n[1],"/maps?q=").concat(n[2].replace("query=","q=").replace("api=1",""),"&output=embed"),i="map");i||("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.format=t.format||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),t.type=i||this.fancybox.option("defaultType","image"),"html5video"!==i&&"video"!==i||(t.video=k({},this.fancybox.option("Html.video"),t.video),t._width&&t._height?t.ratio=parseFloat(t._width)/parseFloat(t._height):t.ratio=t.ratio||t.video.ratio||Z.video.ratio)}}},{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&(t.setContent(e),e.index===t.fancybox.getSlide().index&&t.playVideo(e))}))}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"loadInlineContent",value:function(t){var e;if(t.src instanceof HTMLElement)e=t.src;else if("string"==typeof t.src){var i=t.src.split("#",2),n=2===i.length&&""===i[0]?i[1]:i[0];e=document.getElementById(n)}if(e){if("clone"===t.type||e.$placeHolder){var o=(e=e.cloneNode(!0)).getAttribute("id");o=o?"".concat(o,"--clone"):"clone-".concat(this.fancybox.id,"-").concat(t.index),e.setAttribute("id",o)}else{var a=document.createElement("div");a.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(a,e),e.$placeHolder=a}this.fancybox.setContent(t,e)}else this.fancybox.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"loadAjaxContent",value:function(t){var e=this.fancybox,i=new XMLHttpRequest;e.showLoading(t),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&"ready"===e.state&&(e.hideLoading(t),200===i.status?e.setContent(t,i.responseText):e.setError(t,404===i.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};var n=t.ajax||null;i.open(n?"POST":"GET",t.src),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(n),t.xhr=i}},{key:"loadIframeContent",value:function(t){var e=this,i=this.fancybox,n=document.createElement("iframe");if(n.className="fancybox__iframe",n.setAttribute("id","fancybox__iframe_".concat(i.id,"_").concat(t.index)),n.setAttribute("allow","autoplay; fullscreen"),n.setAttribute("scrolling","auto"),t.$iframe=n,"iframe"!==t.type||!1===t.preload)return n.setAttribute("src",t.src),this.fancybox.setContent(t,n),void this.resizeIframe(t);i.showLoading(t);var o=document.createElement("div");o.style.visibility="hidden",this.fancybox.setContent(t,o),o.appendChild(n),n.onerror=function(){i.setError(t,"{{IFRAME_ERROR}}")},n.onload=function(){i.hideLoading(t);var o=!1;n.isReady||(n.isReady=!0,o=!0),n.src.length&&(n.parentNode.style.visibility="",e.resizeIframe(t),o&&i.revealContent(t))},n.setAttribute("src",t.src)}},{key:"setAspectRatio",value:function(t){var e=t.$content,i=t.ratio;if(e){var n=t._width,o=t._height;if(i||n&&o){Object.assign(e.style,{width:n&&o?"100%":"",height:n&&o?"100%":"",maxWidth:"",maxHeight:""});var a=e.offsetWidth,s=e.offsetHeight;if(o=o||s,(n=n||a)>a||o>s){var r=Math.min(a/n,s/o);n*=r,o*=r}Math.abs(n/o-i)>.01&&(i.1),{top:r,left:l,scale:a&&i?i/a:1,opacity:c}}},{key:"canZoom",value:function(t){var e=this.fancybox,i=e.$container;if(window.visualViewport&&1!==window.visualViewport.scale)return!1;if(t.Panzoom&&!t.Panzoom.content.width)return!1;if(!e.option("Image.zoom")||"contain"!==e.option("Image.fit"))return!1;var n=t.$thumb;if(!n||"loading"===t.state)return!1;i.classList.add("fancybox__no-click");var o,a=n.getBoundingClientRect();if(this.fancybox.option("Image.ignoreCoveredThumbnail")){var s=document.elementFromPoint(a.left+1,a.top+1)===n,r=document.elementFromPoint(a.right-1,a.bottom-1)===n;o=s&&r}else o=document.elementFromPoint(a.left+.5*a.width,a.top+.5*a.height)===n;return i.classList.remove("fancybox__no-click"),o}},{key:"zoomIn",value:function(){var t=this.fancybox,e=t.getSlide(),i=e.Panzoom,n=this.getZoomInfo(e),o=n.top,a=n.left,s=n.scale,r=n.opacity;t.trigger("reveal",e),i.panTo({x:-1*a,y:-1*o,scale:s,friction:0,ignoreBounds:!0}),e.$content.style.visibility="",e.state="zoomIn",!0===r&&i.on("afterTransform",(function(t){"zoomIn"!==e.state&&"zoomOut"!==e.state||(t.$content.style.opacity=Math.min(1,1-(1-t.content.scale)/(1-s)))})),i.panTo({x:0,y:0,scale:1,friction:this.fancybox.option("Image.zoomFriction")})}},{key:"zoomOut",value:function(){var t=this,e=this.fancybox,i=e.getSlide(),n=i.Panzoom;if(n){i.state="zoomOut",e.state="customClosing",i.$caption&&(i.$caption.style.visibility="hidden");var o=this.fancybox.option("Image.zoomFriction"),a=function(e){var a=t.getZoomInfo(i),s=a.top,r=a.left,l=a.scale,c=a.opacity;e||c||(o*=.82),n.panTo({x:-1*r,y:-1*s,scale:l,friction:o,ignoreBounds:!0}),o*=.98};window.addEventListener("scroll",a),n.once("endAnimation",(function(){window.removeEventListener("scroll",a),e.destroy()})),a()}}},{key:"handleCursor",value:function(t){if("image"===t.type&&t.$el){var e=t.Panzoom,i=this.fancybox.option("Image.click",!1,t),n=this.fancybox.option("Image.touch"),o=t.$el.classList,a=this.fancybox.option("Image.canZoomInClass"),s=this.fancybox.option("Image.canZoomOutClass");if(o.remove(s),o.remove(a),e&&"toggleZoom"===i)e&&1===e.content.scale&&e.option("maxScale")-e.content.scale>.01?o.add(a):e.content.scale>1&&!n&&o.add(s);else"close"===i&&o.add(s)}}},{key:"onWheel",value:function(t,e){if("ready"===this.fancybox.state&&!1!==this.fancybox.trigger("Image.wheel",e))switch(this.fancybox.option("Image.wheel")){case"zoom":"done"===t.state&&t.Panzoom&&t.Panzoom.zoomWithWheel(e);break;case"close":this.fancybox.close();break;case"slide":this.fancybox[e.deltaY<0?"prev":"next"]()}}},{key:"onClick",value:function(t,e){var i=this;if("ready"===this.fancybox.state){var n=t.Panzoom;if(!n||!n.dragPosition.midPoint&&0===n.dragOffset.x&&0===n.dragOffset.y&&1===n.dragOffset.scale){if(this.fancybox.Carousel.Panzoom.lockAxis)return!1;var o=function(n){switch(n){case"toggleZoom":e.stopPropagation(),t.Panzoom&&t.Panzoom.zoomWithClick(e);break;case"close":i.fancybox.close();break;case"next":e.stopPropagation(),i.fancybox.next()}},a=this.fancybox.option("Image.click"),s=this.fancybox.option("Image.doubleClick");s?this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null,o(s)):this.clickTimer=setTimeout((function(){i.clickTimer=null,o(a)}),300):o(a)}}}},{key:"onPageChange",value:function(t,e){var i=t.getSlide();e.slides.forEach((function(t){t.Panzoom&&"done"===t.state&&t.index!==i.index&&t.Panzoom.panTo({x:0,y:0,scale:1,friction:.8})}))}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events)}}]),t}();K.defaults={canZoomInClass:"can-zoom_in",canZoomOutClass:"can-zoom_out",zoom:!0,zoomOpacity:"auto",zoomFriction:.82,ignoreCoveredThumbnail:!1,touch:!0,click:"toggleZoom",doubleClick:null,wheel:"zoom",fit:"contain",wrap:!1,Panzoom:{ratio:1}};var J=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onChange","onClosing"];i1?"-"+(o.index+1):""))}n&&(this.origHash=a!==s?a:""),s&&a!==s&&(this.timer=setTimeout((function(){try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+s),n&&(e.hasCreatedHistory=!0)}catch(t){}}),300))}},{key:"onClosing",value:function(){if(this.timer&&clearTimeout(this.timer),!0!==this.hasSilentClose)try{return void window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}},{key:"attach",value:function(t){t.on(this.events)}},{key:"detach",value:function(t){t.off(this.events)}}],[{key:"startFromUrl",value:function(){var e=t.Fancybox;if(e&&!e.getInstance()&&!1!==e.defaults.Hash){var i=t.getParsedURL(),n=i.hash,o=i.slug,a=i.index;if(o){var s=document.querySelector('[data-slug="'.concat(n,'"]'));if(s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),!e.getInstance()){var r=document.querySelectorAll('[data-fancybox="'.concat(o,'"]'));r.length&&(null===a&&1===r.length?s=r[0]:a&&(s=r[a-1]),s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}}}}},{key:"onHashChange",value:function(){var e=t.getParsedURL(),i=e.slug,n=e.index,o=t.Fancybox,a=o&&o.getInstance();if(a&&a.plugins.Hash){if(i){var s=a.Carousel;if(i===a.option("slug"))return s.slideTo(n-1);var r,l=x(s.slides);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.slug&&c.slug===i)return s.slideTo(c.index)}}catch(t){l.e(t)}finally{l.f()}var h=a.getSlide(),d=h.$trigger&&h.$trigger.dataset;if(d&&d.fancybox===i)return s.slideTo(n-1)}a.plugins.Hash.hasSilentClose=!0,a.close()}t.startFromUrl()}},{key:"create",value:function(e){function i(){window.addEventListener("hashchange",t.onHashChange,!1),t.startFromUrl()}t.Fancybox=e,W&&window.requestAnimationFrame((function(){/complete|interactive|loaded/.test(document.readyState)?i():document.addEventListener("DOMContentLoaded",i)}))}},{key:"destroy",value:function(){window.removeEventListener("hashchange",t.onHashChange,!1)}},{key:"getParsedURL",value:function(){var t=window.location.hash.substr(1),e=t.split("-"),i=e.length>1&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||null;return{hash:t,slug:e.join("-"),index:i}}}]),t}(),Q={pageXOffset:0,pageYOffset:0,element:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement},activate:function(t){Q.pageXOffset=window.pageXOffset,Q.pageYOffset=window.pageYOffset,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},deactivate:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},tt=function(){function t(e){o(this,t),this.fancybox=e,this.active=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}return s(t,[{key:"isActive",value:function(){return this.active}},{key:"setTimer",value:function(){var t=this;if(this.active&&!this.timer){var e=this.fancybox.option("slideshow.delay",3e3);this.timer=setTimeout((function(){t.timer=null,t.fancybox.option("infinite")||t.fancybox.getSlide().index!==t.fancybox.Carousel.slides.length-1?t.fancybox.next():t.fancybox.jumpTo(0,{friction:0})}),e);var i=this.$progress;i||((i=document.createElement("div")).classList.add("fancybox__progress"),this.fancybox.$carousel.parentNode.insertBefore(i,this.fancybox.$carousel),this.$progress=i,i.offsetHeight),i.style.transitionDuration="".concat(e,"ms"),i.style.transform="scaleX(1)"}}},{key:"clearTimer",value:function(){clearTimeout(this.timer),this.timer=null,this.$progress&&(this.$progress.style.transitionDuration="",this.$progress.style.transform="",this.$progress.offsetHeight)}},{key:"activate",value:function(){this.active||(this.active=!0,this.fancybox.$container.classList.add("has-slideshow"),"done"===this.fancybox.getSlide().state&&this.setTimer(),document.addEventListener("visibilitychange",this.handleVisibilityChange,!1))}},{key:"handleVisibilityChange",value:function(){this.deactivate()}},{key:"deactivate",value:function(){this.active=!1,this.clearTimer(),this.fancybox.$container.classList.remove("has-slideshow"),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!1)}},{key:"toggle",value:function(){this.active?this.deactivate():this.fancybox.Carousel.slides.length>1&&this.activate()}}]),t}(),et={display:["counter","zoom","slideshow","fullscreen","thumbs","close"],autoEnable:!0,items:{counter:{position:"left",type:"div",class:"fancybox__counter",html:' / ',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'',click:function(t){t.preventDefault(),Q.element()?Q.deactivate():Q.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'',click:function(t){t.preventDefault();var e=this.fancybox.getSlide().Panzoom;e&&e.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'',click:function(t){t.stopPropagation();var e=this.fancybox.plugins.Thumbs;e&&e.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'',attr:{"data-fancybox-close":"",tabindex:0}}}},it=function(){function t(e){var i=this;o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var n=0,a=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];nl.option("baseScale"),h=x(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=x(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;){u.value.innerHTML=e.index+1}}catch(t){f.e(t)}finally{f.f()}var v,p=x(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(p.s();!(v=p.n()).done;){v.value.innerHTML=n}}catch(t){p.e(t)}finally{p.f()}if(!this.fancybox.option("infinite")){var g,m=x(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(g=m.n()).done;){var y=g.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,w=x(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(w.s();!(b=w.n()).done;){var k=b.value;i===n-1?k.setAttribute("disabled",""):k.removeAttribute("disabled")}}catch(t){w.e(t)}finally{w.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();it.defaults=et;var nt={ScrollLock:U,Thumbs:Y,Html:G,Toolbar:it,Image:K,Hash:J},ot={startIndex:0,preload:1,infinite:!0,showClass:"fancybox-zoomInUp",hideClass:"fancybox-fadeOut",animated:!0,hideScrollbar:!0,parentEl:null,mainClass:null,autoFocus:!0,trapFocus:!0,placeFocusBack:!0,click:"close",closeButton:"inside",dragToClose:!0,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},template:{closeButton:'',spinner:'',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},at=new Map,st=0,rt=function(t){l(i,t);var e=f(i);function i(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),t=t.map((function(t){return t.width&&(t._width=t.width),t.height&&(t._height=t.height),t})),(n=e.call(this,k(!0,{},ot,a))).bindHandlers(),n.state="init",n.setItems(t),n.attachPlugins(i.Plugins),n.trigger("init"),!0===n.option("hideScrollbar")&&n.hideScrollbar(),n.initLayout(),n.initCarousel(),n.attachEvents(),at.set(n.id,d(n)),n.trigger("prepare"),n.state="ready",n.trigger("ready"),n.$container.setAttribute("aria-hidden","false"),n.option("trapFocus")&&n.focus(),n}return s(i,[{key:"option",value:function(t){for(var e,n=this.getSlide(),o=n?n[t]:void 0,a=arguments.length,s=new Array(a>1?a-1:0),r=1;r1?i-1:0),o=1;o=150||Math.abs(e)>=35&&t.dragOffset.time<350?(this.option("hideClass")&&(this.getSlide().hideClass="fancybox-throwOut".concat(t.content.y<0?"Up":"Down")),this.close()):"y"===t.lockAxis&&t.panTo({y:0})}},{key:"onTransform",value:function(t){if(this.$backdrop){var e=Math.abs(t.content.y),i=e<1?"":Math.max(.33,Math.min(1,1-e/t.content.fitHeight*1.5));this.$container.style.setProperty("--fancybox-ts",i?"0s":""),this.$container.style.setProperty("--fancybox-opacity",i)}}},{key:"onMousedown",value:function(){"ready"===this.state&&document.body.classList.add("is-using-mouse")}},{key:"onKeydown",value:function(t){if(this.isTopmost()){document.body.classList.remove("is-using-mouse");var e=t.key,i=this.option("keyboard");if(i&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){var n=t.composedPath()[0],o=document.activeElement&&document.activeElement.classList,a=o&&o.contains("carousel__button");if("Escape"!==e&&!a)if(t.target.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return;if(!1!==this.trigger("keydown",e,t)){var s=i[e];"function"==typeof this[s]&&this[s]()}}}}},{key:"getSlide",value:function(){var t=this.Carousel;if(!t)return null;var e=null===t.page?t.option("initialPage"):t.page,i=t.pages||[];return i.length&&i[e]?i[e].slides[0]:null}},{key:"focus",value:function(t){if(!(i.ignoreFocusChange||["init","closing","customClosing","destroy"].indexOf(this.state)>-1)){var e=this.$container,n=this.getSlide(),o="done"===n.state?n.$el:null;if(!o||!o.contains(document.activeElement)){t&&t.preventDefault(),i.ignoreFocusChange=!0;for(var a,s=[],r=0,l=Array.from(e.querySelectorAll(X));r-1?this.lastFocus=t.target:this.lastFocus===e?q(s[s.length-1]):q(e):this.option("autoFocus")&&a?q(a):s.indexOf(document.activeElement)<0&&q(e),this.lastFocus=document.activeElement,i.ignoreFocusChange=!1}}}},{key:"hideScrollbar",value:function(){if(W){var t=window.innerWidth-document.documentElement.getBoundingClientRect().width,e="fancybox-style-noscroll",i=document.getElementById(e);i||t>0&&((i=document.createElement("style")).id=e,i.type="text/css",i.innerHTML=".compensate-for-scrollbar {padding-right: ".concat(t,"px;}"),document.getElementsByTagName("head")[0].appendChild(i),document.body.classList.add("compensate-for-scrollbar"))}}},{key:"revealScrollbar",value:function(){document.body.classList.remove("compensate-for-scrollbar");var t=document.getElementById("fancybox-style-noscroll");t&&t.remove()}},{key:"clearContent",value:function(t){this.Carousel.trigger("removeSlide",t),t.$content&&(t.$content.remove(),t.$content=null),t.$closeButton&&(t.$closeButton.remove(),t.$closeButton=null),t._className&&t.$el.classList.remove(t._className)}},{key:"setContent",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.$el;if(e instanceof HTMLElement)["img","iframe","video","audio"].indexOf(e.nodeName.toLowerCase())>-1?(i=document.createElement("div")).appendChild(e):i=e;else{var a=document.createRange().createContextualFragment(e);(i=document.createElement("div")).appendChild(a)}if(t.filter&&!t.error&&(i=i.querySelector(t.filter)),i instanceof Element)return t._className="has-".concat(n.suffix||t.type||"unknown"),o.classList.add(t._className),i.classList.add("fancybox__content"),"none"!==i.style.display&&"none"!==getComputedStyle(i).getPropertyValue("display")||(i.style.display=t.display||this.option("defaultDisplay")||"flex"),t.id&&i.setAttribute("id",t.id),t.$content=i,o.prepend(i),this.manageCloseButton(t),"loading"!==t.state&&this.revealContent(t),i;this.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"manageCloseButton",value:function(t){var e=this,i=void 0===t.closeButton?this.option("closeButton"):t.closeButton;if(i&&("top"!==i||!this.$closeButton)){var n=document.createElement("button");n.classList.add("carousel__button","is-close"),n.setAttribute("title",this.options.l10n.CLOSE),n.innerHTML=this.option("template.closeButton"),n.addEventListener("click",(function(t){return e.close(t)})),"inside"===i?(t.$closeButton&&t.$closeButton.remove(),t.$closeButton=t.$content.appendChild(n)):this.$closeButton=this.$container.insertBefore(n,this.$container.firstChild)}}},{key:"revealContent",value:function(t){var e=this;this.trigger("reveal",t),t.$content.style.visibility="";var i=!1;t.error||"loading"===t.state||null!==this.Carousel.prevPage||t.index!==this.options.startIndex||(i=void 0===t.showClass?this.option("showClass"):t.showClass),i?(t.state="animating",this.animateCSS(t.$content,i,(function(){e.done(t)}))):this.done(t)}},{key:"animateCSS",value:function(t,e,i){if(t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!0,cancelable:!0})),t&&e){t.addEventListener("animationend",(function n(o){o.currentTarget===this&&(t.removeEventListener("animationend",n),i&&i(),t.classList.remove(e))})),t.classList.add(e)}else"function"==typeof i&&i()}},{key:"done",value:function(t){t.state="done",this.trigger("done",t);var e=this.getSlide();e&&t.index===e.index&&this.option("autoFocus")&&this.focus()}},{key:"setError",value:function(t,e){t.error=e,this.hideLoading(t),this.clearContent(t);var i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"-1)o[l]=!1;else if(i.indexOf(o[l])>-1)o[l]=!0;else try{o[l]=JSON.parse(c)}catch(t){o[l]=c}else o[l]=c}return t instanceof Element&&(o.$trigger=t),o},o=[],a=e.startIndex||0,s=e.target||null,r=void 0!==(e=k({},e,i.openers.get(t))).groupAll&&e.groupAll,l=void 0===e.groupAttr?"data-fancybox":e.groupAttr,c=l&&s?s.getAttribute("".concat(l)):"";if(!s||c||r){var h=e.root||(s?s.getRootNode():document.body);o=[].slice.call(h.querySelectorAll(t))}if(s&&!r&&(o=c?o.filter((function(t){return t.getAttribute("".concat(l))===c})):[s]),!o.length)return!1;var d=i.getInstance();return!(d&&o.indexOf(d.options.$trigger)>-1)&&(a=s?o.indexOf(s):a,new i(o=o.map(n),k({},e,{startIndex:a,$trigger:s})))}},{key:"bind",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function n(){document.body.addEventListener("click",i.fromEvent,!1)}W&&(i.openers.size||(/complete|interactive|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n)),i.openers.set(t,e))}},{key:"unbind",value:function(t){i.openers.delete(t),i.openers.size||i.destroy()}},{key:"destroy",value:function(){for(var t;t=i.getInstance();)t.destroy();i.openers=new Map,document.body.removeEventListener("click",i.fromEvent,!1)}},{key:"getInstance",value:function(t){return t?at.get(t):Array.from(at.values()).reverse().find((function(t){return!t.isClosing()&&t}))||null}},{key:"close",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if(t){var n,o=x(at.values());try{for(o.s();!(n=o.n()).done;){var a=n.value;a.close(e)}}catch(t){o.e(t)}finally{o.f()}}else{var s=i.getInstance();s&&s.close(e)}}},{key:"next",value:function(){var t=i.getInstance();t&&t.next()}},{key:"prev",value:function(){var t=i.getInstance();t&&t.prev()}}]),i}(O);rt.version="4.0.31",rt.defaults=ot,rt.openers=new Map,rt.Plugins=nt,rt.bind("[data-fancybox]");for(var lt=0,ct=Object.entries(rt.Plugins||{});lt {
jQueryNuvem(".js-notification-close, .js-tooltip-close").on( "click", function(e) {
e.preventDefault();
jQueryNuvem(e.currentTarget).closest(".js-notification, .js-tooltip").hide();
});
var $notification_status_page = jQueryNuvem(".js-notification-status-page");
var $fixed_bottom_button = jQueryNuvem(".js-btn-fixed-bottom");
if ($notification_status_page.length > 0){
if (LS.shouldShowOrderStatusNotification($notification_status_page.data('url'))){
$notification_status_page.show();
};
jQueryNuvem(".js-notification-status-page-close").on( "click", function(e) {
e.preventDefault();
LS.dontShowOrderStatusNotificationAgain($notification_status_page.data('url'));
});
}
jQueryNuvem(".js-cart-notification-close").on("click", function(){
jQueryNuvem(".js-alert-added-to-cart").removeClass("notification-visible").addClass("notification-hidden");
setTimeout(function(){
jQueryNuvem('.js-cart-notification-item-img').attr('src', '');
jQueryNuvem(".js-alert-added-to-cart").hide();
},2000);
});
const footerLegal = jQueryNuvem(".js-footer-legal");
restoreNotifications = function(){
// Whatsapp button position
$fixed_bottom_button.css("marginBottom", "10px");
footerLegal.removeAttr("style");
};
if (!window.cookieNotificationService.isAcknowledged()) {
jQueryNuvem(".js-notification-cookie-banner").show();
const cookieBannerHeight = jQueryNuvem(".js-notification-cookie-banner").outerHeight();
footerLegal.css("paddingBottom", cookieBannerHeight + 10 + "px");
$fixed_bottom_button.css("marginBottom", "60px");
if (window.innerWidth > 768) {
$fixed_bottom_button.css("marginBottom", "50px");
}
}
jQueryNuvem(".js-acknowledge-cookies").on( "click", function(e) {
window.cookieNotificationService.acknowledge();
restoreNotifications();
});
restoreQuickshopForm = function(){
jQueryNuvem("#quickshop-modal .js-item-product").removeClass("js-swiper-slide-visible js-item-slide");
jQueryNuvem("#quickshop-modal .js-quickshop-container").attr( { 'data-variants' : '' , 'data-quickshop-id': '' } );
jQueryNuvem("#quickshop-modal .js-item-product").attr('data-product-id', '');
setTimeout(function(){
var $quickshop_form = jQueryNuvem("#quickshop-form").find('.js-product-form');
var $item_form_container = jQueryNuvem(".js-quickshop-opened").find(".js-item-variants");
$quickshop_form.detach().appendTo($item_form_container);
jQueryNuvem(".js-quickshop-opened").removeClass("js-quickshop-opened");
jQueryNuvem("#quickshop-modal .js-quickshop-img").attr('srcset', '');
},350);
};
if (window.innerWidth < 768) {
cleanURLHash = function(){
const uri = window.location.toString();
const clean_uri = uri.substring(0, uri.indexOf("#"));
window.history.replaceState({}, document.title, clean_uri);
};
goBackBrowser = function(){
cleanURLHash();
history.back();
};
if(window.location.href.indexOf("modal-fullscreen") > -1) {
cleanURLHash();
}
jQueryNuvem(document).on("click", ".js-fullscreen-modal-open", function(e) {
e.preventDefault();
var modal_url_hash = jQueryNuvem(this).data("modalUrl");
window.location.hash = modal_url_hash;
});
jQueryNuvem(document).on("click", ".js-fullscreen-modal-close", function(e) {
e.preventDefault();
goBackBrowser();
});
window.onhashchange = function() {
if(window.location.href.indexOf("modal-fullscreen") <= -1) {
if(jQueryNuvem(".js-fullscreen-modal").hasClass("modal-show")){
if(jQueryNuvem(".js-modal.modal-show").length == 1){
jQueryNuvem("body").removeClass("overflow-none");
}
var $opened_modal = jQueryNuvem(".js-fullscreen-modal.modal-show");
var $opened_modal_overlay = $opened_modal.prev();
$opened_modal.removeClass("modal-show");
setTimeout(() => $opened_modal.hide(), 500);
$opened_modal_overlay.fadeOut(500);
restoreQuickshopForm();
}
}
}
}
modalOpen = function(modal_id, openType){
var $overlay_id = jQueryNuvem('.js-modal-overlay[data-modal-id="' + modal_id + '"]');
if (jQueryNuvem(modal_id).hasClass("modal-show")) {
if(jQueryNuvem(".js-modal.modal-show").length == 1){
jQueryNuvem("body").removeClass("overflow-none");
}
let modal = jQueryNuvem(modal_id).removeClass("modal-show");
setTimeout(() => modal.hide(), 500);
} else {
if(!jQueryNuvem(".js-modal.modal-show").length){
jQueryNuvem("body").addClass("overflow-none");
}
jQueryNuvem(modal_id).detach().appendTo("body");
jQueryNuvem(modal_id).show().addClass("modal-show");
if (((jQueryNuvem(modal_id).hasClass("js-modal-overlay-md")) && (window.innerWidth > 768)) || (!jQueryNuvem(modal_id).hasClass("js-modal-overlay-md"))) {
$overlay_id.fadeIn(400);
$overlay_id.detach().insertBefore(modal_id);
}
}
if(openType == 'openFullScreenWithoutClick' && window.innerWidth < 768 && jQueryNuvem(modal_id).hasClass("js-fullscreen-modal")){
var modal_url_hash = jQueryNuvem(modal_id).data("modalUrl");
window.location.hash = modal_url_hash;
}
};
jQueryNuvem(document).on("click", ".js-modal-open", function(e) {
e.preventDefault();
const modal_id = jQueryNuvem(this).data('toggle');
modalOpen(modal_id);
});
jQueryNuvem(document).on("click", ".js-modal-close", function(e) {
e.preventDefault();
if(jQueryNuvem(".js-modal.modal-show").length == 1){
jQueryNuvem("body").removeClass("overflow-none");
}
var $modal = jQueryNuvem(this).closest(".js-modal");
var modal_id = $modal.attr('id');
var $overlay_id = jQueryNuvem('.js-modal-overlay[data-modal-id="#' + modal_id + '"]');
$modal.removeClass("modal-show");
setTimeout(() => $modal.hide(), 500);
$overlay_id.fadeOut(500);
if ((window.innerWidth < 768) && (jQueryNuvem(this).hasClass(".js-fullscreen-modal-close"))) {
goBackBrowser();
}
restoreQuickshopForm();
});
jQueryNuvem(document).on("click", ".js-modal-overlay", function(e) {
e.preventDefault();
if(jQueryNuvem(".js-modal.modal-show").length == 1){
jQueryNuvem("body").removeClass("overflow-none");
}
var modal_id = jQueryNuvem(this).data('modalId');
let modal = jQueryNuvem(modal_id).removeClass("modal-show");
setTimeout(() => modal.hide(), 500);
jQueryNuvem(this).fadeOut(500);
restoreQuickshopForm();
});
jQueryNuvem(document).on("click", ".js-card-collapse-toggle", function(e) {
e.preventDefault();
var parent = jQueryNuvem(this).closest(".js-card-collapse");
parent.find(".js-card-collapse-toggle").toggleClass('active');
parent.toggleClass('active');
});
function toggleAccordion(selector){
if(jQueryNuvem(selector).hasClass("js-accordion-show-only")){
jQueryNuvem(selector).hide();
}else{
jQueryNuvem(selector).find(".js-accordion-toggle-inactive").toggle();
jQueryNuvem(selector).find(".js-accordion-toggle-active").toggle();
}
jQueryNuvem(selector).closest(".js-accordion-container").find(".js-accordion-content").slideToggle("fast");
}
jQueryNuvem(document).on("click", ".js-accordion-toggle", function(e) {
e.preventDefault();
toggleAccordion(this);
});
if(window.innerWidth < 768){
jQueryNuvem(document).on("click", ".js-accordion-toggle-mobile", function(e) {
e.preventDefault();
toggleAccordion(this);
});
jQueryNuvem(".js-accordion-content-mobile").hide();
}else{
jQueryNuvem(".js-accordion-toggle-mobile").css("cursor" , "default").removeAttr('href');
}
const inViewport = (entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting && !entry.target.observed) {
entry.target.classList.add("is-inViewport");
entry.target.observed = true;
}
});
};
// Attach observer to every [data-transition] element:
const ELs_inViewport = document.querySelectorAll('[data-transition]');
ELs_inViewport.forEach(EL => {
EL.observed = false; // Initialize the observed flag for each element
const Obs = new IntersectionObserver(inViewport);
Obs.observe(EL);
});
var adbarAutoplayVal = {delay: 5000,};
createSwiper('.js-swiper-adbar', {
loop: true,
watchOverflow: true,
centerInsufficientSlides: true,
centeredSlides: true,
autoplay: adbarAutoplayVal,
threshold: 5,
slidesPerView: 1,
navigation: {
nextEl: '.js-swiper-adbar-next',
prevEl: '.js-swiper-adbar-prev',
},
});
var $top_nav = jQueryNuvem(".js-mobile-nav");
var $page_main_content = jQueryNuvem(".js-main-content");
var $search_backdrop = jQueryNuvem(".js-search-backdrop");
$top_nav.addClass("move-down").removeClass("move-up");
jQueryNuvem(".js-toggle-menu-panel").click(function (e) {
e.preventDefault();
jQueryNuvem(this).next(".js-menu-panel").show().addClass("nav-list-panel-show");
});
jQueryNuvem(".js-toggle-menu-back").click(function (e) {
e.preventDefault();
var $panel_to_change = jQueryNuvem(this).closest(".js-menu-panel");
$panel_to_change.removeClass("nav-list-panel-show");
setTimeout(function(){
$panel_to_change.hide();
},600);
});
closeHamburgerSubpanels = function() {
jQueryNuvem(".js-menu-panel").removeClass("nav-list-panel-show");
setTimeout(function(){
jQueryNuvem(".js-menu-panel").hide();
},1000);
};
jQueryNuvem(".js-toggle-menu-close, .js-modal-overlay[data-modal-id='#nav-hamburger'").click(function () {
closeHamburgerSubpanels();
});
var win_height = window.innerHeight;
var head_height = jQueryNuvem(".js-head-main").height();
jQueryNuvem(".js-desktop-dropdown").css('maxHeight', (win_height - head_height - 50).toString() + 'px');
jQueryNuvem(".js-item-subitems-desktop").on("mouseenter", function (e) {
jQueryNuvem(e.currentTarget).addClass("active");
}).on("mouseleave", function(e) {
jQueryNuvem(e.currentTarget).removeClass("active");
});
jQueryNuvem(".js-nav-main-item").on("mouseenter", function (e) {
jQueryNuvem('.js-nav-desktop-list').children(".selected").removeClass("selected");
jQueryNuvem(e.currentTarget).addClass("selected");
}).on("mouseleave", function(e) {
const self = jQueryNuvem(this);
setTimeout(function(){
self.removeClass("selected");
},500);
});
jQueryNuvem(".js-nav-desktop-list-arrow").on("mouseenter", function (e) {
jQueryNuvem('.js-desktop-nav-item').removeClass("selected");
});
var menuContainer = jQueryNuvem('.js-nav-desktop-list').first(el => el.offsetWidth);
var headerBannerContainer = jQueryNuvem('.js-head-banners-col').first(el => el.offsetWidth);
var menuItems = 0;
jQueryNuvem('.js-nav-desktop-list > .js-desktop-nav-item').each(function(el) {
menuItems += jQueryNuvem(el).first(el => el.offsetWidth);
});
jQueryNuvem(".js-nav-desktop-list").on("scroll", function() {
var position = jQueryNuvem('.js-nav-desktop-list').prop("scrollLeft");
if(position == 0) {
jQueryNuvem(".js-nav-desktop-list-arrow-left").addClass('disable');
} else {
jQueryNuvem(".js-nav-desktop-list-arrow-left").removeClass('disable');
}
if(position == ( menuItems - menuContainer )) {
jQueryNuvem(".js-nav-desktop-list-arrow-right").addClass('disable');
} else {
jQueryNuvem(".js-nav-desktop-list-arrow-right").removeClass('disable');
}
});
if (menuContainer < menuItems) {
jQueryNuvem('.js-nav-desktop-list').addClass('nav-desktop-with-scroll');
jQueryNuvem('.js-nav-desktop-list-arrow').show();
}
jQueryNuvem(".js-menu-and-banners-row").css("visibility" , "visible");
jQueryNuvem('.js-nav-desktop-list-arrow-right').on("click", function() {
var posL = jQueryNuvem('.js-nav-desktop-list').prop("scrollLeft") + 400;
jQueryNuvem('.js-nav-desktop-list').each((el) => el.scroll({ left: posL, behavior: 'smooth' }));
});
jQueryNuvem('.js-nav-desktop-list-arrow-left').on("click", function() {
var posR = jQueryNuvem('.js-nav-desktop-list').prop("scrollLeft") - 400;
jQueryNuvem('.js-nav-desktop-list').each((el) => el.scroll({ left: posR, behavior: 'smooth' }));
});
jQueryNuvem(".js-desktop-dropdown").on("mouseleave", function (e) {
const self = jQueryNuvem(this);
self.css("pointer-events" , "none");
setTimeout(function(){
self.css("pointer-events" , "initial");
},1000);
});
jQueryNuvem(".js-search-button").on("click", function (e) {
if (window.innerWidth < 768) {
setTimeout(function(){
jQueryNuvem("#nav-search .js-search-input").each(el => el.focus());
},10);
}else{
var searchBox = jQueryNuvem(this).closest(".js-search-controls-wrapper").find(".js-search-container");
searchBox.addClass("expanded");
searchBox.find(".js-search-input").each(el => el.focus());
}
});
var $category_controls = jQueryNuvem(".js-category-controls");
function applyOffset(selector){
// Get nav height on load
if (window.innerWidth > 768) {
var head_height = jQueryNuvem(".js-head-main").height();
jQueryNuvem(selector).css("paddingTop", head_height.toString() + 'px');
}else{
var head_height = 0;
}
// Apply offset nav height on load
window.addEventListener("resize", function() {
// Get nav height on resize
var head_height = jQueryNuvem(".js-head-main").height();
// Apply offset on resize
if (window.innerWidth > 768) {
jQueryNuvem(selector).css("paddingTop", head_height.toString() + 'px');
}else{
jQueryNuvem(selector).css("paddingTop", "0px");
}
});
}
applyOffset(".js-head-offset");
if (window.innerWidth < 768) {
var topbarHeight = jQueryNuvem(".js-adbar").outerHeight();
}else{
var topbarHeight = jQueryNuvem(".js-topbar").outerHeight();
}
window.addEventListener("scroll", function() {
var scrolledPosition = window.pageYOffset;
var header = jQueryNuvem(".js-head-main");
var navbarHeight = header.outerHeight();
if (scrolledPosition > navbarHeight) {
header.addClass('compress').css('top', -topbarHeight + 'px' );
} else {
header.removeClass('compress').css("top", "0px");
}
});
LS.search(jQueryNuvem(".js-search-input"), function (html, count) {
$search_suggests = jQueryNuvem(this).closest(".js-search-container").next(".js-search-suggest");
if (count > 0) {
$search_suggests.html(html).show();
} else {
$search_suggests.hide();
}
if (jQueryNuvem(this).val().length == 0) {
$search_suggests.hide();
}
}, {
snipplet: 'header/header-search-results.tpl'
});
if (window.innerWidth > 768) {
jQueryNuvem("body").on("click", function () {
jQueryNuvem(".js-search-suggest").hide();
});
jQueryNuvem(document).on("click", ".js-search-suggest a", function () {
jQueryNuvem(".js-search-suggest").show();
});
}
jQueryNuvem(".js-search-suggest").on("click", ".js-search-suggest-all-link", function (e) {
e.preventDefault();
$this_closest_form = jQueryNuvem(this).closest(".js-search-suggest").prev(".js-search-form");
$this_closest_form.submit();
});
changeLang = function(element) {
var selected_country_url = element.find("option").filter((el) => el.selected).attr("data-country-url");
location.href = selected_country_url;
};
jQueryNuvem('.js-lang-select').on("change", function (e) {
lang_select_option = jQueryNuvem(this);
changeLang(lang_select_option);
});
var slidesPerViewDesktopVal = 6;
var slidesPerViewMobileVal = 2.25;
var itemSwiperSpaceBetween = 20;
hideSwiperControls = function(elemPrev, elemNext) {
if((jQueryNuvem(elemPrev).hasClass("swiper-button-disabled") && jQueryNuvem(elemNext).hasClass("swiper-button-disabled"))){
jQueryNuvem(elemPrev).remove();
jQueryNuvem(elemNext).remove();
}
};
// Set loop for related products products sliders
function calculateRelatedLoopVal(sectionSelector) {
let productsAmount = jQueryNuvem(sectionSelector).attr("data-related-amount");
let loopVal = false;
const applyLoop = (window.innerWidth < 768 && productsAmount > slidesPerViewMobileVal) || (window.innerWidth > 768 && productsAmount > slidesPerViewDesktopVal);
if (applyLoop) {
loopVal = true;
}
return loopVal;
}
let alternativeLoopVal = calculateRelatedLoopVal(".js-related-products");
let complementaryLoopVal = calculateRelatedLoopVal(".js-complementary-products");
createSwiper('.js-swiper-related', {
lazy: true,
loop: alternativeLoopVal,
watchOverflow: true,
threshold: 5,
watchSlideProgress: true,
watchSlidesVisibility: true,
slideVisibleClass: 'js-swiper-slide-visible',
spaceBetween: itemSwiperSpaceBetween,
slidesPerView: slidesPerViewMobileVal,
navigation: {
nextEl: '.js-swiper-related-next',
prevEl: '.js-swiper-related-prev',
},
on: {
afterInit: function () {
hideSwiperControls(".js-swiper-related-prev", ".js-swiper-related-next");
},
},
breakpoints: {
768: {
slidesPerView: slidesPerViewDesktopVal,
}
}
});
createSwiper('.js-swiper-complementary', {
lazy: true,
loop: complementaryLoopVal,
watchOverflow: true,
threshold: 5,
watchSlideProgress: true,
watchSlidesVisibility: true,
slideVisibleClass: 'js-swiper-slide-visible',
spaceBetween: itemSwiperSpaceBetween,
slidesPerView: slidesPerViewMobileVal,
navigation: {
nextEl: '.js-swiper-complementary-next',
prevEl: '.js-swiper-complementary-prev',
},
on: {
afterInit: function () {
hideSwiperControls(".js-swiper-complementary-prev", ".js-swiper-complementary-next");
},
},
breakpoints: {
768: {
slidesPerView: slidesPerViewDesktopVal,
}
}
});
var width = window.innerWidth;
if (width < 767) {
createSwiper('.js-informative-banners', {
slidesPerView: 1,
watchOverflow: true,
centerInsufficientSlides: true,
pagination: {
el: '.js-informative-banners-pagination',
clickable: true,
},
breakpoints: {
640: {
slidesPerView: 3,
}
}
});
}
createSwiper('.js-informative-banners-demo', {
slidesPerView: 1,
watchOverflow: true,
centerInsufficientSlides: true,
pagination: {
el: '.js-informative-banners-pagination-demo',
clickable: true,
},
breakpoints: {
640: {
slidesPerView: 3,
}
}
});
var nav_height = jQueryNuvem(".js-head-main").innerHeight();
const noStockVariants = (container = null) => {
const config = {
variantsGroup: ".js-product-variants-group",
variantButton: ".js-insta-variant",
noStockClass: "btn-variant-no-stock",
dataVariationId: "data-variation-id",
dataOption: "data-option"
};
const wrapper = container ? container : jQueryNuvem('#single-product');
if (!wrapper) return;
const dataVariants = wrapper.data('variants');
const variantsLength = wrapper.find(config.variantsGroup).length;
const getOptions = (productVariationId, variantOption) => {
if (productVariationId === 2) {
return {
option0: String(wrapper.find(`${config.variantsGroup}[${config.dataVariationId}="0"] select`).val()),
option1: String(wrapper.find(`${config.variantsGroup}[${config.dataVariationId}="1"] select`).val()),
option2: String(jQueryNuvem(variantOption).attr('data-option')),
};
} else if (productVariationId === 1) {
return {
option0: String(wrapper.find(`${config.variantsGroup}[${config.dataVariationId}="0"] select`).val()),
option1: String(jQueryNuvem(variantOption).attr('data-option')),
};
} else {
return {
option0: String(jQueryNuvem(variantOption).attr('data-option')),
};
}
};
const filterVariants = (options) => {
return dataVariants.filter(variant => {
return Object.keys(options).every(optionKey => variant[optionKey] === options[optionKey]) && variant.available;
});
};
const updateStockStatus = (productVariationId) => {
const variationGroup = wrapper.find(`${config.variantsGroup}[${config.dataVariationId}="${productVariationId}"]`);
variationGroup.find(`${config.variantButton}.${config.noStockClass}`).removeClass(config.noStockClass);
variationGroup.find(config.variantButton).each((variantOption, item) => {
const options = getOptions(productVariationId, variantOption);
const itemsAvailable = filterVariants(options);
const button = wrapper.find(`${config.variantsGroup}[${config.dataVariationId}="${productVariationId}"] ${config.variantButton}[${config.dataOption}="${options[`option${productVariationId}`].replace(/"/g, '\\"')}"]`);
if (!itemsAvailable.length) {
button.addClass(config.noStockClass);
}
});
};
for (let productVariationId = variantsLength - 1; productVariationId >= 0; productVariationId--) {
updateStockStatus(productVariationId);
}
};
noStockVariants();
jQueryNuvem(document).on("click", ".js-quickshop-modal-open", function (e) {
e.preventDefault();
var $this = jQueryNuvem(this);
if($this.hasClass("js-quickshop-slide")){
jQueryNuvem("#quickshop-modal .js-item-product").addClass("js-swiper-slide-visible js-item-slide");
}
let container = jQueryNuvem(this).closest('.js-quickshop-container');
if (!container.length) return;
noStockVariants(container);
LS.fillQuickshop($this);
if (window.innerWidth < 768) {
var product_image_dimension = jQueryNuvem(this).closest('.js-item-product').find('.js-item-image-padding').attr("style");
jQueryNuvem("#quickshop-modal .js-quickshop-image-padding").attr("style", product_image_dimension);
}
});
changeVariantButton = function(selector, parentSelector) {
selector.siblings().removeClass("selected");
selector.addClass("selected");
var option_id = selector.attr('data-option');
var parent = selector.closest(parentSelector);
var selected_option = parent.find('.js-variation-option option').filter(function (el) {
return el.value == option_id;
});
selected_option.prop('selected', true).trigger('change');
}
jQueryNuvem(document).on("click", ".js-insta-variant", function (e) {
e.preventDefault();
$this = jQueryNuvem(this);
changeVariantButton($this, '.js-product-variants-group');
});
LS.registerOnChangeVariant(function(variant){
const productContainer = jQueryNuvem('.js-item-product[data-product-id="'+variant.product_id+'"]');
const current_image = productContainer.find('.js-item-image');
current_image.attr('srcset', variant.image_url);
const swiperElement = productContainer.find('.js-product-item-slider-container-private.swiper-container-initialized');
if(swiperElement.length){
productContainer.find('.js-product-item-slider-slide-private').removeClass('item-image-slide');
setTimeout(function(){
const productImageLink = productContainer.find('.js-product-item-image-link-private');
const imageToKeep = productContainer.find('.js-swiper-slide-visible img').clone();
// Destroy the Swiper instance
if (itemProductSliders[variant.product_id]) {
itemProductSliders[variant.product_id].destroy(true, true);
delete itemProductSliders[variant.product_id];
}
// Remove the Swiper elements
swiperElement.remove();
productContainer.find('.js-product-item-slider-pagination-container-private').remove();
// Insert the cloned image into the link
productImageLink.append(imageToKeep);
},300);
}
productContainer.find(".js-product-item-private-with-secondary-images").addClass("product-item-secondary-images-disabled");
});
function get_max_installments_without_interests(number_of_installment, installment_data, max_installments_without_interests) {
if (parseInt(number_of_installment) > parseInt(max_installments_without_interests[0])) {
if (installment_data.without_interests) {
return [number_of_installment, installment_data.installment_value.toFixed(2)];
}
}
return max_installments_without_interests;
}
function get_max_installments_with_interests(number_of_installment, installment_data, max_installments_with_interests) {
if (parseInt(number_of_installment) > parseInt(max_installments_with_interests[0])) {
if (installment_data.without_interests == false) {
return [number_of_installment, installment_data.installment_value.toFixed(2)];
}
}
return max_installments_with_interests;
}
function refreshInstallmentv2(price){
jQueryNuvem(".js-modal-installment-price" ).each(function( el ) {
const installment = Number(jQueryNuvem(el).data('installment'));
jQueryNuvem(el).text(LS.currency.display_short + (price/installment).toLocaleString('de-DE', {maximumFractionDigits: 2, minimumFractionDigits: 2}));
});
}
function refreshPaymentDiscount(price){
jQueryNuvem(".js-price-with-discount" ).each(function( el ) {
const payment_discount = jQueryNuvem(el).data('paymentDiscount');
jQueryNuvem(el).text(LS.formatToCurrency(price - ((price * payment_discount) / 100)))
});
}
function togglePaymentDiscounts(variant){
jQueryNuvem(".js-payment-method-total").each(function( paymentMethodTotalElement ){
const priceComparerElement = jQueryNuvem(paymentMethodTotalElement).find(".js-compare-price-display");
const installmentsOnePaymentElement = jQueryNuvem(paymentMethodTotalElement).find('.js-installments-no-discount');
const priceWithDiscountElement = jQueryNuvem(paymentMethodTotalElement).find('.js-price-with-discount');
priceComparerElement.hide();
installmentsOnePaymentElement.hide();
priceWithDiscountElement.hide();
const discount = priceWithDiscountElement.data('paymentDiscount');
if (discount > 0 && showMaxPaymentDiscount(variant)){
priceComparerElement.show();
priceWithDiscountElement.show()
} else {
installmentsOnePaymentElement.show();
}
})
}
function updateDiscountDisclaimers(variant){
updateProductDiscountDisclaimer(variant);
updatePopupDiscountDisclaimers(variant);
}
function updateProductDiscountDisclaimer(variant){
jQueryNuvem(".js-product-discount-container, .js-product-discount-disclaimer").hide();
if (showMaxPaymentDiscount(variant)){
jQueryNuvem(".js-product-discount-container").show();
}
if (showMaxPaymentDiscountNotCombinableDisclaimer(variant)){
jQueryNuvem(".js-product-discount-disclaimer").show();
}
}
function updatePopupDiscountDisclaimers(variant){
jQueryNuvem(".js-modal-tab-discount, .js-payment-method-discount").hide();
if (showMaxPaymentDiscount(variant)){
jQueryNuvem("#method_pagos-personalizados .js-modal-tab-discount").show();
}
jQueryNuvem(".js-info-payment-method-container").each(function(infoPaymentMethodElement){
const infoPaymentMethod = jQueryNuvem(infoPaymentMethodElement)
infoPaymentMethod.find(".js-discount-explanation").hide();
infoPaymentMethod.find(".js-discount-disclaimer").hide();
const priceWithDiscountElement = infoPaymentMethod.find('.js-price-with-discount');
const discount = priceWithDiscountElement.data('paymentDiscount');
if (discount > 0 && showMaxPaymentDiscount(variant)){
infoPaymentMethod.find(".js-discount-explanation").show();
infoPaymentMethod.find(".js-payment-method-discount").show();
}
if (discount > 0 && showMaxPaymentDiscountNotCombinableDisclaimer(variant)){
infoPaymentMethod.find(".js-discount-disclaimer").show();
}
})
}
function variantHasPromotionalPrice(variant) { return variant.compare_at_price_number > variant.price_number }
function showMaxPaymentDiscount(variant) {
return true;
}
function showMaxPaymentDiscountNotCombinableDisclaimer(variant) {
return false
}
function changeVariant(variant) {
jQueryNuvem(".js-product-detail .js-shipping-calculator-response").hide();
jQueryNuvem("#shipping-variant-id").val(variant.id);
var parent = jQueryNuvem("body");
if (variant.element) {
parent = jQueryNuvem(variant.element);
if(parent.hasClass("js-quickshop-container")){
var quick_id = parent.attr("data-quickshop-id");
var parent = jQueryNuvem('.js-quickshop-container[data-quickshop-id="'+quick_id+'"]');
}
}
if(parent.hasClass("js-quickshop-container")){
var itemContainer = parent.closest('.js-item-product');
if(itemContainer.hasClass("js-item-slide")){
var parent = jQueryNuvem('.js-swiper-slide-visible .js-quickshop-container[data-quickshop-id="'+quick_id+'"]');
}
noStockVariants(parent);
} else {
noStockVariants();
}
var sku = parent.find('.js-product-sku');
if(sku.length) {
sku.text(variant.sku).show();
}
var installment_helper = function($element, amount, price){
$element.find('.js-installment-amount').text(amount);
$element.find('.js-installment-price').attr("data-value", price);
$element.find('.js-installment-price').text(LS.currency.display_short + parseFloat(price).toLocaleString('de-DE', { minimumFractionDigits: 2 }));
if(variant.price_short && Math.abs(variant.price_number - price * amount) < 1) {
$element.find('.js-installment-total-price').text((variant.price_short).toLocaleString('de-DE', { minimumFractionDigits: 2 }));
} else {
$element.find('.js-installment-total-price').text(LS.currency.display_short + (price * amount).toLocaleString('de-DE', { minimumFractionDigits: 2 }));
}
};
if (variant.installments_data) {
var variant_installments = JSON.parse(variant.installments_data);
var max_installments_without_interests = [0,0];
var max_installments_with_interests = [0,0];
jQueryNuvem('.js-payment-provider-installments-row').hide();
for (let payment_method in variant_installments) {
var paymentMethodId = '#installment_' + payment_method.replace(" ", "_") + '_1';
var minimumInstallmentValue = jQueryNuvem(paymentMethodId).closest('.js-info-payment-method').attr("data-minimum-installment-value");
let installments = variant_installments[payment_method];
for (let number_of_installment in installments) {
let installment_data = installments[number_of_installment];
max_installments_without_interests = get_max_installments_without_interests(number_of_installment, installment_data, max_installments_without_interests);
max_installments_with_interests = get_max_installments_with_interests(number_of_installment, installment_data, max_installments_with_interests);
var installment_container_selector = '#installment_' + payment_method.replace(" ", "_") + '_' + number_of_installment;
if(minimumInstallmentValue <= installment_data.installment_value) {
jQueryNuvem(installment_container_selector).show();
}
if(!parent.hasClass("js-quickshop-container")){
installment_helper(jQueryNuvem(installment_container_selector), number_of_installment, installment_data.installment_value.toFixed(2));
}
}
}
var $installments_container = jQueryNuvem(variant.element + ' .js-max-installments-container .js-max-installments');
var $installments_modal_link = jQueryNuvem(variant.element + ' #btn-installments');
var $payments_module = jQueryNuvem(variant.element + ' .js-product-payments-container');
var $installmens_card_icon = jQueryNuvem(variant.element + ' .js-installments-credit-card-icon');
var installments_to_use = max_installments_without_interests[0] > 1 ? max_installments_without_interests : max_installments_with_interests;
if(installments_to_use[0] <= 1 ) {
$installments_container.hide();
$installments_modal_link.hide();
$payments_module.hide();
$installmens_card_icon.hide();
} else {
$installments_container.show();
$installments_modal_link.show();
$payments_module.show();
$installmens_card_icon.show();
installment_helper($installments_container, installments_to_use[0], installments_to_use[1]);
}
}
if(!parent.hasClass("js-quickshop-container")){
jQueryNuvem('#installments-modal .js-installments-one-payment').text(variant.price_short).attr("data-value", variant.price_number);
}
if (variant.price_short){
parent.find('.js-price-display').text(variant.price_short).show();
parent.find('.js-price-display').attr("content", variant.price_number).data('productPrice', variant.price_number_raw);
parent.find('.js-payment-discount-price-product').text(variant.price_with_payment_discount_short);
parent.find('.js-payment-discount-price-product-container').show();
parent.find('.js-price-without-taxes').text(variant.price_without_taxes);
parent.find('.js-price-without-taxes-container').show();
} else {
parent.find('.js-price-display, .js-payment-discount-price-product-container, .js-price-without-taxes-container').hide();
}
if ((variant.compare_at_price_short) && !(parent.find(".js-price-display").css("display") == "none")) {
parent.find('.js-compare-price-display').text(variant.compare_at_price_short).show();
} else {
parent.find('.js-compare-price-display').hide();
}
var button = parent.find('.js-addtocart');
button.removeClass('cart').removeClass('contact').removeClass('nostock');
var $product_shipping_calculator = parent.find("#product-shipping-container");
if (!variant.available){
button.val('Sin stock');
button.addClass('nostock');
button.attr('disabled', 'disabled');
$product_shipping_calculator.hide();
} else if (variant.contact) {
button.val('Consultar precio');
button.addClass('contact');
button.removeAttr('disabled');
$product_shipping_calculator.hide();
} else {
button.val('Agregar al carrito');
button.addClass('cart');
button.removeAttr('disabled');
$product_shipping_calculator.show();
}
const base_price = Number(jQueryNuvem("#price_display").attr("content"));
refreshInstallmentv2(base_price);
refreshPaymentDiscount(variant.price_number);
togglePaymentDiscounts(variant);
updateDiscountDisclaimers(variant);
if(variant.stock == 1) {
parent.find('.js-last-product').show();
} else {
parent.find('.js-last-product').hide();
}
LS.updateShippingProduct();
zipcode_on_changevariant = jQueryNuvem("#product-shipping-container .js-shipping-input").val();
jQueryNuvem("#product-shipping-container .js-shipping-calculator-current-zip").text(zipcode_on_changevariant);
LS.subscriptionChangeVariant(variant);
}
jQueryNuvem(document).on("change", ".js-variation-option", function(e) {
var $parent = jQueryNuvem(this).closest(".js-product-variants");
var $variants_group = jQueryNuvem(this).closest(".js-product-variants-group");
var $quickshop_parent_wrapper = jQueryNuvem(this).closest(".js-quickshop-container");
var quick_id = $quickshop_parent_wrapper.attr("data-quickshop-id");
if($parent.hasClass("js-product-quickshop-variants")){
var $quickshop_parent = jQueryNuvem(this).closest(".js-item-product");
if($quickshop_parent.hasClass("js-item-slide")){
var $quickshop_variant_selector = '.js-swiper-slide-visible .js-quickshop-container[data-quickshop-id="'+quick_id+'"]';
}else{
var $quickshop_variant_selector = '.js-quickshop-container[data-quickshop-id="'+quick_id+'"]';
}
LS.changeVariant(changeVariant, $quickshop_variant_selector);
var selected_option_id = jQueryNuvem(this).val();
var $color_parent_to_update = jQueryNuvem('.js-quickshop-container[data-quickshop-id="'+quick_id+'"]');
$color_parent_to_update.find('.js-color-variant[data-option="'+selected_option_id+'"]').addClass("selected").siblings().removeClass("selected");
$variants_group.find('.js-insta-variant[data-option="'+selected_option_id+'"]').addClass("selected").siblings().removeClass("selected");
} else {
LS.changeVariant(changeVariant, '#single-product');
}
var $this_product_container = jQueryNuvem(this).closest(".js-product-container");
if($this_product_container.hasClass("js-quickshop-container")){
var this_quickshop_id = $this_product_container.attr("data-quickshop-id");
var $this_product_container = jQueryNuvem('.js-product-container[data-quickshop-id="'+this_quickshop_id+'"]');
}
var $this_compare_price = $this_product_container.find(".js-compare-price-display");
var $this_price = $this_product_container.find(".js-price-display");
var $installment_container = $this_product_container.find(".js-product-payments-container");
var $installment_text = $this_product_container.find(".js-max-installments-container");
var $this_add_to_cart = $this_product_container.find(".js-prod-submit-form");
// Get the current product discount percentage value
var current_percentage_value = $this_product_container.find(".js-offer-percentage");
// Get the current product price and promotional price
var compare_price_value = $this_compare_price.html();
var price_value = $this_price.html();
// Calculate new discount percentage based on difference between filtered old and new prices
const percentageDifference = window.moneyDifferenceCalculator.percentageDifferenceFromString(compare_price_value, price_value);
if(percentageDifference){
$this_product_container.find(".js-offer-percentage").text(percentageDifference);
$this_product_container.find(".js-offer-label").css("display" , "table");
}
if ($this_compare_price.css("display") == "none" || !percentageDifference) {
$this_product_container.find(".js-offer-label").hide();
}
if ($this_add_to_cart.hasClass("nostock")) {
$this_product_container.find(".js-stock-label").show();
}
else {
$this_product_container.find(".js-stock-label").hide();
}
if ($this_price.css('display') == 'none'){
$installment_container.hide();
$installment_text.hide();
}else{
$installment_text.show();
}
});
jQueryNuvem(".js-product-form").on("submit", function (e) {
var button = jQueryNuvem(e.currentTarget).find('[type="submit"]');
button.attr('disabled', 'disabled');
if ((button.hasClass('contact')) || (button.hasClass('catalog'))) {
e.preventDefault();
var product_id = jQueryNuvem(e.currentTarget).find("input[name='add_to_cart']").val();
window.location = "\/contacto\/?product=" + product_id;
} else if (button.hasClass('cart')) {
button.val('Agregando...');
}
});
var has_multiple_slides = false;
var has_multiple_slides = true;
Fancybox.bind('[data-fancybox="product-gallery"]', {
Toolbar: {
items: {
close: {
class: 'w-auto px-2 p-md-0',
html: '',
},
counter: {
class: 'mt-2',
type: 'div',
html: ' / ',
position: 'center',
},
},
},
Carousel: {
Navigation: {
classNames: {
button: 'svg-circle svg-circle-invert',
next: 'swiper-button-absolute swiper-button-next mr-3 mr-md-2',
prev: 'swiper-button-absolute swiper-button-prev ml-3 ml-md-2',
},
prevTpl: '',
nextTpl: '',
},
},
Thumbs: { autoStart: false },
on: {
shouldClose: (fancybox, slide) => {
// Update position of the slider
productSwiper.slideTo( fancybox.getSlide().index, 0 );
jQueryNuvem(".js-product-thumb").removeClass("selected");
var $product_thumbnail = jQueryNuvem(".js-product-thumb[data-thumb-loop='"+fancybox.getSlide().index+"']").addClass("selected");
if($product_thumbnail.length){
$product_thumbnail.addClass("selected");
}else{
jQueryNuvem(".js-product-thumb[data-thumb-loop='4']").addClass("selected");
}
},
},
});
function productSliderNav(){
var width = window.innerWidth;
var productSwiper = null;
createSwiper(
'.js-swiper-product', {
lazy: true,
effect: 'fade',
fadeEffect: {
crossFade: true,
},
slidesPerView: 1,
watchOverflow: true,
pagination: {
el: '.js-swiper-product-pagination',
clickable: true,
},
navigation: {
nextEl: '.js-swiper-product-next',
prevEl: '.js-swiper-product-prev',
},
},
function(swiperInstance) {
productSwiper = swiperInstance;
}
);
Fancybox.bind('[data-fancybox="product-gallery"]', {
Toolbar: {
items: {
close: {
class: 'w-auto px-2 p-md-0',
html: '',
},
counter: {
class: 'mt-2',
type: 'div',
html: ' / ',
position: 'center',
},
},
},
Carousel: {
Navigation: {
classNames: {
button: 'svg-circle svg-circle-invert',
next: 'swiper-button-absolute swiper-button-next mr-3 mr-md-2',
prev: 'swiper-button-absolute swiper-button-prev ml-3 ml-md-2',
},
prevTpl: '',
nextTpl: '',
},
},
Thumbs: { autoStart: false },
on: {
shouldClose: (fancybox, slide) => {
// Update position of the slider
productSwiper.slideTo( fancybox.getSlide().index, 0 );
jQueryNuvem(".js-product-thumb").removeClass("selected");
var $product_thumbnail = jQueryNuvem(".js-product-thumb[data-thumb-loop='"+fancybox.getSlide().index+"']").addClass("selected");
if($product_thumbnail.length){
$product_thumbnail.addClass("selected");
}else{
jQueryNuvem(".js-product-thumb[data-thumb-loop='4']").addClass("selected");
}
},
},
});
if(has_multiple_slides) {
LS.registerOnChangeVariant(function(variant){
var liImage = jQueryNuvem('.js-swiper-product').find("[data-image='"+variant.image+"']");
var selectedPosition = liImage.data('imagePosition');
var slideToGo = parseInt(selectedPosition);
productSwiper.slideTo(slideToGo);
jQueryNuvem(".js-product-slide-img").removeClass("js-active-variant");
liImage.find(".js-product-slide-img").addClass("js-active-variant");
});
jQueryNuvem(".js-product-thumb").on("click", function(e){
e.preventDefault();
jQueryNuvem(".js-product-thumb").removeClass("selected");
jQueryNuvem(e.currentTarget).addClass("selected");
var thumbLoop = jQueryNuvem(e.currentTarget).data("thumbLoop");
var slideToGo = parseInt(thumbLoop);
productSwiper.slideTo(slideToGo);
if(jQueryNuvem(e.currentTarget).hasClass("js-product-thumb-modal")){
jQueryNuvem('.js-swiper-product').find("[data-image-position='"+slideToGo+"'] .js-product-slide-link").trigger('click');
}
});
}
}
if (window.innerWidth > 767) {
var directionVal = 'vertical';
}else{
var directionVal = 'horizontal';
}
createSwiper('.js-swiper-product-thumbs', {
lazy: true,
watchOverflow: true,
threshold: 5,
direction: directionVal,
navigation: {
nextEl: '.js-swiper-product-thumbs-next',
prevEl: '.js-swiper-product-thumbs-prev',
},
slidesPerView: 'auto',
on: {
afterInit: function () {
hideSwiperControls(".js-swiper-product-thumbs-prev", ".js-swiper-product-thumbs-next");
},
},
});
productSliderNav()
jQueryNuvem('.js-pinterest-share').on("click", function(e){
e.preventDefault();
jQueryNuvem(".pinterest-hidden a").get()[0].click();
});
if (window.innerWidth > 767) {
jQueryNuvem("#product-description").show();
}else{
jQueryNuvem("#product-description").insertAfter("#product_form").show();
}
jQueryNuvem(document).on("click", ".js-quantity .js-quantity-up", function (e) {
$quantity_input = jQueryNuvem(this).closest(".js-quantity").find(".js-quantity-input");
$quantity_input.val( parseInt($quantity_input.val(), 10) + 1);
});
jQueryNuvem(document).on("click", ".js-quantity .js-quantity-down", function (e) {
$quantity_input = jQueryNuvem(this).closest(".js-quantity").find(".js-quantity-input");
quantity_input_val = $quantity_input.val();
if (quantity_input_val>1) {
$quantity_input.val( parseInt($quantity_input.val(), 10) - 1);
}
});
var head_height = jQueryNuvem(".js-head-main").outerHeight();
if (window.innerWidth > 768) {
jQueryNuvem("#cart-sticky-summary").css("top" , (head_height + 10).toString() + 'px');
}
function getQuickShopImgSrc(element){
const image = jQueryNuvem(element).closest('.js-quickshop-container').find('img');
return String(image.attr('srcset'));
}
jQueryNuvem(document).on("click", ".js-addtocart:not(.js-addtocart-placeholder)", function (e) {
var $productContainer = jQueryNuvem(this).closest('.js-product-container');
var $productVariants = $productContainer.find(".js-variation-option");
var $productButton = $productContainer.find("input[type='submit'].js-addtocart");
var $productButtonPlaceholder = $productContainer.find(".js-addtocart-placeholder");
var $productButtonText = $productButtonPlaceholder.find(".js-addtocart-text");
var $productButtonAdding = $productButtonPlaceholder.find(".js-addtocart-adding");
var $productButtonSuccess = $productButtonPlaceholder.find(".js-addtocart-success");
var isQuickShop = $productContainer.hasClass('js-quickshop-container');
var isCrossSelling = $productContainer.hasClass('js-cross-selling-container');
if (isCrossSelling) {
var imageSrc = $productContainer.find('.js-cross-selling-product-image').attr('src');
var quantity = $productContainer.data('quantity')
var name = $productContainer.find('.js-cross-selling-product-name').text();
var price = $productContainer.find('.js-cross-selling-promo-price').text();
var addedToCartCopy = $productContainer.data('add-to-cart-translation');
} else if (!isQuickShop) {
if(jQueryNuvem(".js-product-slide-img.js-active-variant").length) {
var $activeVariantImg = $productContainer.find('.js-product-slide-img.js-active-variant');
var imageSrc = $activeVariantImg.attr('srcset') || $activeVariantImg.data('srcset');
} else {
var $defaultImg = $productContainer.find('.js-product-slide-img');
var imageSrc = $defaultImg.attr('srcset') || $defaultImg.data('srcset');
}
imageSrc = imageSrc ? imageSrc.split(' ')[0] : '';
var quantity = $productContainer.find('.js-quantity-input').val();
var name = $productContainer.find('.js-product-name').text();
var price = $productContainer.find('.js-price-display').text();
var addedToCartCopy = "Agregar al carrito";
} else {
var imageSrc = getQuickShopImgSrc(this);
var quantity = 1;
var name = $productContainer.find('.js-item-name').text();
var price = $productContainer.find('.js-price-display').text().trim();
var addedToCartCopy = "Comprar";
if ($productContainer.hasClass("js-quickshop-has-variants")) {
var addedToCartCopy = "Agregar al carrito";
}else{
var addedToCartCopy = "Comprar";
}
}
if (!jQueryNuvem(this).hasClass('contact')) {
e.preventDefault();
$productButton.hide();
$productButtonPlaceholder.css('display' , 'inline-block');
$productButtonText.fadeOut();
$productButtonAdding.addClass("active");
function restore_button_initial_state(){
$productButtonAdding.removeClass("active");
$productButtonText.fadeIn();
$productButtonPlaceholder.removeAttr("style").hide();
$productButton.show();
}
var subscription_callback_error = function() {
setTimeout(function() {
restore_button_initial_state();
}, 500);
};
const subscriptionValidResult = LS.subscriptionSubmit($productContainer, subscription_callback_error, e);
if (subscriptionValidResult && subscriptionValidResult.changeCartSubmit) {
return;
}
var callback_add_to_cart = function(html_notification_related_products, html_notification_cross_selling) {
jQueryNuvem('.js-cart-notification-item-img').attr('srcset', imageSrc);
jQueryNuvem('.js-cart-notification-item-name').text(name);
jQueryNuvem('.js-cart-notification-item-quantity').text(quantity);
jQueryNuvem('.js-cart-notification-item-price').text(price);
if($productVariants.length){
var output = [];
$productVariants.each( function(el){
var variants = jQueryNuvem(el);
output.push(variants.val());
});
jQueryNuvem(".js-cart-notification-item-variant-container").show();
jQueryNuvem(".js-cart-notification-item-variant").text(output.join(', '))
}else{
jQueryNuvem(".js-cart-notification-item-variant-container").hide();
}
var cartItemsBadge = jQueryNuvem(".js-cart-widget-amount");
var cartItemsMoney = jQueryNuvem(".js-cart-widget-total");
var cartItemsAmount = cartItemsBadge.text();
cartItemsBadge.removeClass("d-none d-md-inline-block");
if (window.innerWidth > 768) {
cartItemsMoney.removeClass("d-none d-md-inline-block");
}
if(cartItemsAmount > 1){
jQueryNuvem(".js-cart-counts-plural").show();
jQueryNuvem(".js-cart-counts-singular").hide();
}else{
jQueryNuvem(".js-cart-counts-singular").show();
jQueryNuvem(".js-cart-counts-plural").hide();
}
$productButtonAdding.removeClass("active");
$productButtonSuccess.addClass("active");
setTimeout(function(){
$productButtonSuccess.removeClass("active");
$productButtonText.fadeIn();
},2000);
setTimeout(function(){
$productButtonPlaceholder.removeAttr("style").hide();
$productButton.show();
},3000);
$productContainer.find(".js-added-to-cart-product-message").slideDown();
if (isQuickShop) {
jQueryNuvem("#quickshop-modal").removeClass('modal-show');
jQueryNuvem(".js-modal-overlay[data-modal-id='#quickshop-modal']").hide();
jQueryNuvem("body").removeClass("overflow-none");
restoreQuickshopForm();
if (window.innerWidth < 768) {
cleanURLHash();
}
}
let notificationWithRelatedProducts = false;
function recommendProductsOnAddToCart(){
jQueryNuvem('.js-related-products-notification-container').html("");
modalOpen('#related-products-notification');
jQueryNuvem('.js-related-products-notification-container').html(html_notification_related_products).show();
// Set loop for recommended products
function calculateRelatedNotificationLoopVal(sectionSelector) {
let productsAmount = jQueryNuvem(sectionSelector).attr("data-related-amount");
let loopVal = false;
const applyLoop = (window.innerWidth < 768 && productsAmount > 2.5) || (window.innerWidth > 768 && productsAmount > 3);
if (applyLoop) {
loopVal = true;
}
return loopVal;
}
let cartRelatedLoopVal = calculateRelatedNotificationLoopVal(".js-related-products-notification");
// Create new swiper on add to cart
createSwiper('.js-swiper-related-products-notification', {
lazy: true,
loop: cartRelatedLoopVal,
watchOverflow: true,
threshold: 5,
watchSlideProgress: true,
watchSlidesVisibility: true,
spaceBetween: itemSwiperSpaceBetween,
slideVisibleClass: 'js-swiper-slide-visible',
slidesPerView: 2.5,
navigation: {
nextEl: '.js-swiper-related-products-notification-next',
prevEl: '.js-swiper-related-products-notification-prev',
},
on: {
afterInit: function () {
hideSwiperControls(".js-swiper-related-products-notification-prev", ".js-swiper-related-products-notification-next");
},
},
breakpoints: {
768: {
slidesPerView: 3.5,
}
}
});
}
notificationWithRelatedProducts = html_notification_related_products != null;
if(notificationWithRelatedProducts){
if (isQuickShop) {
setTimeout(function(){
recommendProductsOnAddToCart();
},300);
}else{
recommendProductsOnAddToCart();
}
}
let shouldShowCrossSellingModal = html_notification_cross_selling != null;
if(!notificationWithRelatedProducts){
const cartOpenType = jQueryNuvem("#modal-cart").attr('data-cart-open-type');
if((cartOpenType === 'show_cart') && !shouldShowCrossSellingModal){
modalOpen('#modal-cart', 'openFullScreenWithoutClick');
}else{
setTimeout(function(){
jQueryNuvem(".js-alert-added-to-cart").show().addClass("notification-visible").removeClass("notification-hidden");
},500);
if (!cookieService.get('first_product_added_successfully')) {
cookieService.set('first_product_added_successfully', 1, 7 );
} else{
setTimeout(function(){
jQueryNuvem(".js-alert-added-to-cart").removeClass("notification-visible").addClass("notification-hidden");
setTimeout(function(){
jQueryNuvem('.js-cart-notification-item-img').attr('src', '');
jQueryNuvem(".js-alert-added-to-cart").hide();
},2000);
},8000);
}
}
}
if (html_notification_cross_selling != null) {
jQueryNuvem('.js-cross-selling-modal-body').html("");
modalOpen('#js-cross-selling-modal');
jQueryNuvem('.js-cross-selling-modal-body').html(html_notification_cross_selling).show();
}
const crossSellingContainer = document.querySelector('.js-cross-selling-container');
if (crossSellingContainer) {
LS.fillCrossSelling(crossSellingContainer);
}
if (jQueryNuvem("#product-shipping-container .js-shipping-input").val()) {
zipcode_on_addtocart = jQueryNuvem("#product-shipping-container .js-shipping-input").val();
jQueryNuvem("#cart-shipping-container .js-shipping-input").val(zipcode_on_addtocart);
jQueryNuvem(".js-shipping-calculator-current-zip").text(zipcode_on_addtocart);
} else if (cookieService.get('calculator_zipcode')){
var zipcode_from_cookie = cookieService.get('calculator_zipcode');
jQueryNuvem('.js-shipping-input').val(zipcode_from_cookie);
jQueryNuvem(".js-shipping-calculator-current-zip").text(zipcode_from_cookie);
}
jQueryNuvem(".js-fs-add-this-product").hide();
jQueryNuvem(".js-fs-add-one-more").show();
if (isCrossSelling) {
jQueryNuvem('#js-cross-selling-modal .js-modal-close').trigger('click');
}
}
var callback_error = function(){
restore_button_initial_state();
}
$prod_form = jQueryNuvem(this).closest("form");
LS.addToCartEnhanced(
$prod_form,
addedToCartCopy,
'Agregando...',
'¡Uy! No tenemos más stock de este producto para agregarlo al carrito.',
false,
callback_add_to_cart,
callback_error
);
}
});
jQueryNuvem(document).on("keypress", ".js-cart-quantity-input", function (e) {
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
jQueryNuvem(document).on("focusout", ".js-cart-quantity-input", function (e) {
var itemID = jQueryNuvem(this).attr("data-item-id");
var itemVAL = jQueryNuvem(this).val();
if (itemVAL == 0) {
var r = confirm("¿Seguro que quieres borrar este artículo?");
if (r == true) {
LS.removeItem(itemID, true);
} else {
jQueryNuvem(this).val(1);
}
} else {
LS.changeQuantity(itemID, itemVAL, true);
}
});
jQueryNuvem(".js-trigger-empty-cart-alert").on("click", function (e) {
e.preventDefault();
let emptyCartAlert = jQueryNuvem(".js-mobile-nav-empty-cart-alert").fadeIn(100);
setTimeout(() => emptyCartAlert.fadeOut(500), 1500);
});
jQueryNuvem('form[action="\/comprar\/"]').on("submit", function() {
cookieService.remove('first_product_added_successfully');
});
if (jQueryNuvem('.js-selected-shipping-method').length) {
var shipping_cost = jQueryNuvem('.js-selected-shipping-method').data("cost");
var $shippingCost = jQueryNuvem("#shipping-cost");
$shippingCost.text(shipping_cost);
$shippingCost.removeClass('opacity-40');
}
selectShippingOption = function(elem, save_option) {
jQueryNuvem(".js-shipping-method, .js-branch-method").removeClass('js-selected-shipping-method');
jQueryNuvem(elem).addClass('js-selected-shipping-method');
var shipping_cost = jQueryNuvem(elem).data("cost");
var shipping_price_clean = jQueryNuvem(elem).data("price");
if(shipping_price_clean = 0.00){
var shipping_cost = ''
}
// Updates shipping (ship and pickup) cost on cart
var $shippingCost = jQueryNuvem("#shipping-cost");
$shippingCost.text(shipping_cost);
$shippingCost.removeClass('opacity-40');
if (save_option) {
LS.saveCalculatedShipping(true);
}
if (jQueryNuvem(elem).hasClass("js-shipping-method-hidden")) {
if (jQueryNuvem(elem).hasClass("js-pickup-option")) {
jQueryNuvem(".js-other-pickup-options, .js-show-other-pickup-options .js-shipping-see-less").show();
jQueryNuvem(".js-show-other-pickup-options .js-shipping-see-more").hide();
} else {
jQueryNuvem(".js-other-shipping-options, .js-show-more-shipping-options .js-shipping-see-less").show();
jQueryNuvem(".js-show-more-shipping-options .js-shipping-see-more").hide()
}
}
};
if (cookieService.get('calculator_zipcode')) {
var zipcode_from_cookie = cookieService.get('calculator_zipcode');
jQueryNuvem('#product-shipping-container .js-shipping-input').val(zipcode_from_cookie);
jQueryNuvem(".js-shipping-calculator-current-zip").text(zipcode_from_cookie);
jQueryNuvem(".js-shipping-calculator-head").addClass("with-zip").removeClass("with-form");
jQueryNuvem(".js-shipping-calculator-with-zipcode").addClass("transition-up-active");
jQueryNuvem(".js-shipping-calculator-spinner").show();
} else {
jQueryNuvem(".js-shipping-calculator-form").addClass("transition-up-active");
}
removeShippingSuboptions = function(){
var shipping_suboptions_id = jQueryNuvem(".js-modal-shipping-suboptions").attr("id");
jQueryNuvem("#" + shipping_suboptions_id).remove();
jQueryNuvem('.js-modal-overlay[data-modal-id="#' + shipping_suboptions_id + '"').remove();
};
jQueryNuvem(".js-calculate-shipping").on("click", function (e) {
e.preventDefault();
let shipping_input_val = jQueryNuvem(e.currentTarget).closest(".js-shipping-calculator-form").find(".js-shipping-input").val();
jQueryNuvem(".js-shipping-input").val(shipping_input_val);
if (jQueryNuvem(".js-cart-item").length) {
LS.calculateShippingAjax(
jQueryNuvem('#cart-shipping-container').find(".js-shipping-input").val(),
'\/envio\/',
jQueryNuvem("#cart-shipping-container").closest(".js-shipping-calculator-container") );
}
jQueryNuvem(".js-shipping-calculator-current-zip").html(shipping_input_val);
removeShippingSuboptions();
});
jQueryNuvem(".js-shipping-input").on('keydown', function (e) {
var key = e.which ? e.which : e.keyCode;
var enterKey = 13;
if (key === enterKey) {
e.preventDefault();
jQueryNuvem(e.currentTarget).closest(".js-shipping-calculator-form").find(".js-calculate-shipping").trigger('click');
if (window.innerWidth < 768) {
jQueryNuvem(e.currentTarget).trigger('blur');
}
}
});
jQueryNuvem(document).on("change", ".js-shipping-method, .js-branch-method", function (e) {
selectShippingOption(this, true);
jQueryNuvem(".js-shipping-method-unavailable").hide();
});
jQueryNuvem(document).on('shipping.options.checked', '.js-shipping-method', function (e) {
let shippingPrice = jQueryNuvem(this).attr("data-price");
LS.addToTotal(shippingPrice);
let total = (LS.data.cart.total / 100) + parseFloat(shippingPrice);
jQueryNuvem(".js-cart-widget-total").html(LS.formatToCurrency(total));
selectShippingOption(this, false);
});
jQueryNuvem(document).on("click", ".js-toggle-more-shipping-options", function(e) {
e.preventDefault();
if(jQueryNuvem(this).hasClass("js-show-other-pickup-options")){
jQueryNuvem(".js-other-pickup-options").slideToggle(600);
jQueryNuvem(".js-show-other-pickup-options .js-shipping-see-less, .js-show-other-pickup-options .js-shipping-see-more").toggle();
}else{
jQueryNuvem(".js-other-shipping-options").slideToggle(600);
jQueryNuvem(".js-show-more-shipping-options .js-shipping-see-less, .js-show-more-shipping-options .js-shipping-see-more").toggle();
}
});
calculateCartShippingOnLoad = function() {
if (jQueryNuvem("#cart-shipping-container .js-shipping-input").val()) {
// If user already had calculated shipping: recalculate shipping
setTimeout(function() {
LS.calculateShippingAjax(
jQueryNuvem('#cart-shipping-container').find(".js-shipping-input").val(),
'\/envio\/',
jQueryNuvem("#cart-shipping-container").closest(".js-shipping-calculator-container") );
removeShippingSuboptions();
toggleAccordion("#cart-shipping-container .js-toggle-shipping");
}, 100);
}
if (jQueryNuvem(".js-branch-method").hasClass('js-selected-shipping-method')) {
}
};
jQueryNuvem(document).on("click", ".js-shipping-calculator-change-zipcode", function(e) {
e.preventDefault();
jQueryNuvem(".js-shipping-calculator-response").fadeOut(100);
jQueryNuvem(".js-shipping-calculator-head").addClass("with-form").removeClass("with-zip");
jQueryNuvem(".js-shipping-calculator-with-zipcode").removeClass("transition-up-active");
jQueryNuvem(".js-shipping-calculator-form").addClass("transition-up-active");
});
jQueryNuvem(document).on("click", ".js-save-shipping-country", function(e) {
e.preventDefault();
lang_select_option = jQueryNuvem(this).closest(".js-modal-shipping-country");
changeLang(lang_select_option);
jQueryNuvem(this).text('Aplicando...').addClass("disabled");
});
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (isIOS) {
var ios_input_fields = jQueryNuvem("input[type='text'], input[type='number'], input[type='password'], input[type='tel'], textarea, input[type='search'], input[type='hidden'], input[type='email']");
ios_input_fields.addClass("form-control-ios");
jQueryNuvem(".js-quantity").addClass("form-group-quantity-ios");
jQueryNuvem(".js-cart-quantity-container").addClass("cart-quantity-container-ios");
jQueryNuvem(".js-big-search-mobile").toggleClass("pb-3 pb-2");
jQueryNuvem(".js-price-filter-btn").addClass("price-btn-ios");
jQueryNuvem(".js-price-filter-empty").addClass("input-clear-content-ios");
jQueryNuvem(".js-calculate-shipping").css("padding", "7px");
}
jQueryNuvem(".js-winnie-pooh-form").on("submit", function (e) {
jQueryNuvem(e.currentTarget).attr('action', '');
});
jQueryNuvem(".js-form").on("submit", function (e) {
jQueryNuvem(e.currentTarget).find('.js-form-spinner').show();
});
jQueryNuvem('.js-password-view').on("click", function (e) {
jQueryNuvem(e.currentTarget).toggleClass('password-view');
if(jQueryNuvem(e.currentTarget).hasClass('password-view')){
jQueryNuvem(e.currentTarget).parent().find(".js-password-input").attr('type', '');
jQueryNuvem(e.currentTarget).find(".js-eye-open, .js-eye-closed").toggle();
} else {
jQueryNuvem(e.currentTarget).parent().find(".js-password-input").attr('type', 'password');
jQueryNuvem(e.currentTarget).find(".js-eye-open, .js-eye-closed").toggle();
}
});
});
});
{{ERROR}}
"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this;t.state="loading",t.$el.classList.add("is-loading");var i=t.$el.querySelector(".fancybox__spinner");i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",(function(){e.Carousel.Panzoom.velocity||e.close()})),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slideNext()}},{key:"prev",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slidePrev()}},{key:"jumpTo",value:function(){var t;this.Carousel&&(t=this.Carousel).slideTo.apply(t,arguments)}},{key:"isClosing",value:function(){return["closing","customClosing","destroy"].includes(this.state)}},{key:"isTopmost",value:function(){return i.getInstance().id==this.id}},{key:"close",value:function(t){var e=this;if(t&&t.preventDefault(),!this.isClosing()&&!1!==this.trigger("shouldClose",t)&&(this.state="closing",this.Carousel.Panzoom.destroy(),this.detachEvents(),this.trigger("closing",t),"destroy"!==this.state)){this.$container.setAttribute("aria-hidden","true"),this.$container.classList.add("is-closing");var i=this.getSlide();if(this.Carousel.slides.forEach((function(t){t.$content&&t.index!==i.index&&e.Carousel.trigger("removeSlide",t)})),"closing"===this.state){var n=void 0===i.hideClass?this.option("hideClass"):i.hideClass;this.animateCSS(i.$content,n,(function(){e.destroy()}),!0)}}}},{key:"destroy",value:function(){if("destroy"!==this.state){this.state="destroy",this.trigger("destroy");var t=this.option("placeFocusBack")?this.option("triggerTarget",this.getSlide().$trigger):null;this.Carousel.destroy(),this.detachPlugins(),this.Carousel=null,this.options={},this.events={},this.$container.remove(),this.$container=this.$backdrop=this.$carousel=null,t&&q(t),at.delete(this.id);var e=i.getInstance();e?e.focus():(document.documentElement.classList.remove("with-fancybox"),document.body.classList.remove("is-using-mouse"),this.revealScrollbar())}}}],[{key:"show",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i(t,e)}},{key:"fromEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.defaultPrevented&&!(t.button&&0!==t.button||t.ctrlKey||t.metaKey||t.shiftKey)){var n,o,a,s=t.composedPath()[0],r=s;if((r.matches("[data-fancybox-trigger]")||(r=r.closest("[data-fancybox-trigger]")))&&(e.triggerTarget=r,n=r&&r.dataset&&r.dataset.fancyboxTrigger),n){var l=document.querySelectorAll('[data-fancybox="'.concat(n,'"]')),c=parseInt(r.dataset.fancyboxIndex,10)||0;r=l.length?l[c]:r}Array.from(i.openers.keys()).reverse().some((function(e){a=r||s;var i=!1;try{a instanceof Element&&("string"==typeof e||e instanceof String)&&(i=a.matches(e)||(a=a.closest(e)))}catch(t){}return!!i&&(t.preventDefault(),o=e,!0)}));var h=!1;if(o){e.event=t,e.target=a,a.origTarget=s,h=i.fromOpener(o,e);var d=i.getInstance();d&&"ready"===d.state&&t.detail&&document.body.classList.add("is-using-mouse")}return h}}},{key:"fromOpener",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){for(var e=["false","0","no","null","undefined"],i=["true","1","yes"],n=Object.assign({},t.dataset),o={},a=0,s=Object.entries(n);a| Ubicación de la tienda | Haedo Haedo, Buenos Aires-GBA, Argentina |
¡No se encontraron reseñas!


No se encontraron comentarios para este producto. ¡Sé el primero en comentar!