(function($){$(document).on('click','div[data-layer]',function(){let lo_datalayer=$(this).attr('data-layer');lo_datalayer=JSON.parse(lo_datalayer);if(typeof lo_datalayer!=='object'){return}
dataLayer.push(lo_datalayer)});$(document).on('click','a[data-layer]',function(){let lo_datalayer=$(this).attr('data-layer');lo_datalayer=JSON.parse(lo_datalayer);if(typeof lo_datalayer!=='object'){return}
dataLayer.push(lo_datalayer)});function getSiteToken(){return $('meta[data-token="token"]').attr('data-value')}
function removeWishlistClass(){const ps_uniqueid=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!ps_uniqueid){$('.j-add-to-wishlist').removeClass('j-active');return}
$(`.j-add-to-wishlist[data-uniqueid="${ps_uniqueid}"]`).removeClass('j-active')}
function addWishlistClass(ps_uniqueid){if(!ps_uniqueid){return}
$(`.j-add-to-wishlist[data-uniqueid="${ps_uniqueid}"]`).addClass('j-active')}
$(document).on('click','.j-add-to-wishlist',function(e){e.preventDefault();e.stopPropagation();$(this).closest('.product-container').find('#errorMessage').addClass('is-hidden');const ls_uniqueid=$(this).attr('data-uniqueid');const ls_barcode=$(this).attr('data-barcode');if(!ls_uniqueid||ls_uniqueid==''){alert('Something went wrong, please refresh and try again')}
const lb_validbarcode=(!ls_barcode||ls_barcode=='');if(!$(this).hasClass('j-active')&&$(this).attr('data-required')==1&&lb_validbarcode){$('html, body').animate({scrollTop:0},'slow');$(this).closest('.product-container').find('#errorMessage').html('Please select a size').removeClass('is-hidden');return}
peppercheckout.globals.$eventbus.$emit('togglewishlistproduct',{variantid:ls_uniqueid,barcode:ls_barcode})});window.ps=window.ps||{};ps.currentBreakpoint=null;ps.breakpoints={xl:1600,lg:1200,md:750,sm:360,};enquire.register('screen and (min-width: 1201px)',{match(){$('body').addClass('desktop');ps.currentBreakpoint='lg'},unmatch(){$('body').removeClass('desktop')},}).register('screen and (min-width: 751px) and (max-width: 1200px)',{match(){$('body').addClass('tablet');ps.currentBreakpoint='md'},unmatch(){$('body').removeClass('tablet')},}).register('screen and (max-width: 750px)',{match(){$('body').addClass('mobile');ps.currentBreakpoint='sm'},unmatch(){$('body').removeClass('mobile')},}).register('screen and (max-width: 360px)',{match(){$('body').addClass('mobileSmall');ps.currentBreakpoint='xs'},unmatch(){$('body').removeClass('mobileSmall')},});$('select.selPlaceholder').on('change',function(){if(!$(this).val()){$(this).addClass('selPlaceholder')}else{$(this).removeClass('selPlaceholder')}});$(document).on('click','.s-dropdown-styled, .s-dropdown-swatch',function(e){$('.s-dropdown-styled, s-dropdown-swatch').not(this).find('ul').slideUp();$(this).find('ul').slideToggle();$(this).toggleClass('is-active')});$(document).on('click','.s-dropdown-border',function(){$('.s-dropdown-border').not(this).find('ul').slideUp();$(this).find('ul').slideToggle();$(this).toggleClass('is-active')});function showdatalabel(po_event){if(typeof po_event==='object'){po_event.stopPropagation()}
$(this).closest('[data-label]').toggleClass('j-label',!$(this).val()=='')}
$.fn.extend({showdatalabels(){return $(this).each(showdatalabel)},});$('[data-label] input, [data-label] textarea').showdatalabels();$(document).on('keyup','[data-label] input, [data-label] textarea',$.debounce(showdatalabel,100));$(document).on('click','.s-inc, .s-dec',function(){const button=$(this);const oldValue=button.parent().find('input').val();if(button.hasClass('s-inc')){var newVal=parseFloat(oldValue)+1}else if(oldValue>0){var newVal=parseFloat(oldValue)-1}else{newVal=0}
button.parent().find('input').val(newVal)});const iOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const ratio=window.devicePixelRatio||1;const screen={width:window.screen.width*ratio,height:window.screen.height*ratio,};if(iOS&&screen.width==1125&&screen.height===2436){$('body').addClass('iphoneX')}
const go_pickers={};$('.s-input-date-picker').each(function(li_index){const lo_input=$(this).find('input:first');const lo_field=$(this).get(0);const lo_picker=new Pikaday({field:lo_field,input:lo_input,format:'D MMM YYYY',onSelect(){this._o.input.val(this.getDate().toLocaleDateString())},});$(this).data('picker-index',li_index);go_pickers[li_index]=lo_picker;$(this).on('click',function(){const li_thisindex=$(this).data('picker-index');const lo_thispicker=go_pickers[li_thisindex];if(typeof lo_thispicker==='object'){lo_thispicker.show()}})});window.overlay={$elem:$('.j-overlay'),timeout:null,show(cover){overlay.$elem.addClass('is-active').css('z-index',cover?'200':'');clearTimeout(overlay.timeout)},hide(){overlay.$elem.removeClass('is-active');GlobalEventBus.$emit('hidesearchresult');overlay.timeout=setTimeout(()=>{overlay.$elem.removeAttr('style')},300)},};$('.j-overlay').on('click',overlay.hide);enquire.register('(max-width: 1200px)',{match(){$('.j-menu-toggle').on('click.menu',function(){const lb_isActive=$(this).attr('aria-expanded')==='true';const lo_menu=$(`#${$(this).attr('aria-controls')}`);const lo_clonedMenu=lo_menu.clone().appendTo('body').css('max-height','none');const li_maxHeight=lo_clonedMenu.height()+20;lo_clonedMenu.remove();$(this).attr('aria-expanded',!lb_isActive);lo_menu.toggleClass('is-active');if(lb_isActive){lo_menu.removeAttr('style')}else{lo_menu.css('max-height',li_maxHeight)}})},unmatch(){$('.j-menu-toggle').off('click.menu')},});function togglepasswordvisibility(){const lo_input=$(this).prev('input');const ls_currenttype=lo_input.attr('type');lo_input.attr('type',ls_currenttype==='password'?'text':'password');$(this).toggleClass('icon-eye').toggleClass('icon-eye-slash')}
$(document).on('click','.j-toggle-password',togglepasswordvisibility);const closestByClass=function(el,clazz){while(el.className!=clazz){el=el.parentNode;if(!el){return null}}
return el};function liftcurtain(po_event){const lo_wrapper=$('#popup-wrapper');const lo_curtain=$('#curtain');const lo_popup=$('#popup');function removepopup(){$(document).off('.curtain');lo_wrapper.remove();lo_curtain.remove();lo_popup.remove()}
if(typeof po_event==='undefined'||po_event.type==='click'||(po_event.type==='keydown'&&po_event.keyCode==27)){lo_curtain.removeClass('is-showing');lo_popup.removeClass('is-showing');setTimeout(removepopup,$('.s-slide-in').length?500:0)}
if($('body').hasClass('is-unscrollable')){$('body').removeClass('is-unscrollable')}
$(document).off('click','.swatchProductQV input');$(document).off('click','.productAddToCartQuickview');$(document).off('click','.jSwatch input');$(document).off('click','.jStock');$(document).off('click','.j-addToCartUp');$(document).off('submit','.s-form')}
function dropcurtain(ps_type,po_options){if($('#curtain').length){liftcurtain()}
$(document).on('keydown.curtain',liftcurtain);$(document).on('click','.j-close-popup, .s-close-popup, .j-close-slide-in, .s-curtain',liftcurtain);if(ps_type==='popup'){$(document.body).prepend(`${po_options.curtain ? '<div id="popup-wrapper" class="s-popup-wrapper"><div id="curtain" class="s-curtain s-curtain--popup"></div>' : ''}<div id="popup" class="s-${po_options.class || ps_type} loading ${po_options.id}"></div></div>`)}else{$(document.body).prepend(`${po_options.curtain ? '<div id="curtain" class="s-curtain"></div>' : ''}<div id="popup" class="s-${po_options.class || ps_type} loading ${po_options.id}"></div>`)}
po_options.data.token=getSiteToken();$.get(po_options.url,po_options.data,(ps_response)=>{$('#curtain').addClass('is-showing');$('#popup').html(ps_response).removeClass('loading').addClass('is-showing');typeof po_options.callback==='function'&&po_options.callback()})}
function basepopup(ps_id,ps_url,po_data,pb_curtain,pf_callback){return{id:ps_id,url:ps_url,data:po_data||{},curtain:typeof pb_curtain==='undefined'?!0:pb_curtain,}}
window.loadpopup=function(ps_id,ps_url,po_data,pb_curtain,pf_callback){dropcurtain('popup',$.extend({},basepopup.apply(null,arguments)))};window.loadslidein=function(ps_id,ps_url,po_data,pb_curtain,pf_callback){dropcurtain('slide-in',$.extend({},basepopup.apply(null,arguments)))};$(document).on('click','.j-toggle-login-register',(po_event)=>{po_event.preventDefault();loadslidein('slide-in--login-register','/slide-in-login-register')});$(document).on('click','.j-toggle-tab',function(){const self=$(this);$('.j-toggle-tab').attr('aria-expanded','false').removeClass('is-active');self.attr('aria-expanded','true').addClass('is-active');$('[id$="-tab"]').addClass('is-hidden');$(`#${self.attr('aria-controls')}`).removeClass('is-hidden')});$(document).on('click','.j-followBrand',function(e){e.preventDefault();const self=$(this);$.post('/ajax-customer-brands',{bid:self.attr('data-bid')},(po_response)=>{if(po_response.success){self.html(po_response.html);$(`#navcustomerbrands-${po_response.type}`).html(po_response.brandhtml);if(po_response.brandhtml.length>0){$(`#navyourbrands-${po_response.type}`).show()}else{$(`#navyourbrands-${po_response.type}`).hide()}}else{loadslidein('slide-in--log-in','/slide-in-login-register')}})});const ls_cookiename='show_bp_welcome';const ls_cookie=$.getCookie(ls_cookiename);const enableWelcomePopup=(typeof(window.enableWelcomePopup)!=='undefined')?window.enableWelcomePopup:!0;if((enableWelcomePopup)&&(ls_cookie!=='')){setTimeout(()=>{if(!$('.j-category.is-locked').length){loadpopup('s-popup--bottom popup-welcome','/popup-welcome',null,!1);$.setCookie(ls_cookiename,'',-1)}},2000)}
$(document).on('click','.j-shop-look',function(){const li_page=$(this).attr('data-page');loadpopup('popup-shop-look','/popup-shop-look',{i:li_page})});$(document).on('click','.j-quickview',function(){const style=$(this).attr('data-style');loadpopup('popup-quickview','/popup-quickview',{style})});$(document).on('click','.j-upsell',()=>{loadpopup('popup-upsell','/popup-upsell');return!1});$('.j-notify-popup').on('click',()=>{loadpopup('popup-notify','/popup-notify')});$(document).on('click','.jSwatchDots',function(e){const ls_uniqueid=$(this).attr('data-uniqueid');if(ls_uniqueid==''){return}
updateToBagButton($(this),'','');$(this).closest('.jWishListItems').find('.s-image').addClass('is-hidden');$(this).closest('.jWishListItems').find(`.s-image[data-uniqueid="${ls_uniqueid}"]`).removeClass('is-hidden');$(this).closest('.co-cart__item-update').find('.co-size').addClass('is-hidden');$(this).closest('.co-cart__item-update').find(`.co-size[data-uniqueid="${ls_uniqueid}"]`).removeClass('is-hidden')});$(document).on('click','.s-dropdown-styled li, .s-dropdown-swatch li',function(){let ls_barcode=$(this).attr('data-barcode');if(typeof ls_barcode==='undefined'||ls_barcode==''){return}
const ls_uniqueid=$(this).attr('data-uniqueid');const ls_markup=$(this).html();$(this).closest('.s-dropdown-styled, .s-dropdown-swatch').find('.s-toggler-list').html(ls_markup);$(this).closest('.j-details').find(`.jItemSoldout[data-uniqueid="${ls_uniqueid}"]`).addClass('is-hidden');$(this).closest('.j-details').find(`.jItemLow[data-uniqueid="${ls_uniqueid}"]`).addClass('is-hidden');ls_class='';if($(this).attr('data-stock')==''||$(this).attr('data-stock')==0){ls_class='is-disabled';ls_barcode='';$(this).closest('.j-details').find(`.jItemSoldout[data-uniqueid="${ls_uniqueid}"]`).removeClass('is-hidden')}else if($(this).attr('data-stock')<5){$(this).closest('.j-details').find(`.jItemLow[data-uniqueid="${ls_uniqueid}"]`).removeClass('is-hidden')}
updateToBagButton($(this),ls_barcode,ls_class)});$(document).on('click','.jAddWishToCart',function(){$(this).prev('.s-error').addClass('is-hidden');const ls_barcode=$(this).attr('data-barcode');if(ls_barcode==''){$(this).prev('.s-error').html('Please choose a size').removeClass('is-hidden');return}
peppercheckout.globals.$eventbus.$emit('addproducttocart',{variantid:ls_barcode,quantity:1});peppercheckout.globals.$eventbus.$emit('setactivetab',{tab:'bag'});removeWishlistClass($(this).attr('data-uniqueid'))});function updateToBagButton(jQ,barcode,styleClass){const button=$(jQ).closest('.jWishListItems').find('.jAddWishToCart');button.attr('data-barcode',barcode);if(styleClass==''){button.removeClass('is-disabled')}else{button.addClass(styleClass)}}
if($('#v-site-header').length){const siteCartSlider=Vue.component('ps-cart-slider').extend({templateOverride:'#vc-component-cart-slider',data(){return{activetab:'bag',showpopup:!1,}},computed:{numberofwishlistitems(){return(this.$store.state.wishlistitems.length>0)},upsellitems(){return this.$store.state.upsellitems},upselltype(){return this.$store.state.upselltype},wishlistitems(){return this.$store.state.wishlistitems},},methods:{switchtab(tab){this.activetab=tab},removewishlistitem(uniqueid){if(typeof uniqueid!=='undefined'){peppercheckout.globals.$eventbus.$emit('togglewishlistproduct',{variantid:uniqueid})}},onscroll(){if($('body').hasClass('mobile')){var cart={scrollPos:$('.cart-slider').scrollTop(),tabsHeight:$('.cart-slider__head').outerHeight(),fixedElementHeight:$('.cart-slider__fixed-header').outerHeight(),checkoutButtonPos:$('.cart-slider__button')[0].getBoundingClientRect().top,screenHeight:$(window).height(),fixElement(){$('.cart-slider').addClass('has-fixed-button')},unfixElement(){$('.cart-slider').removeClass('has-fixed-button')},hideElement(){$('.cart-slider').addClass('is-scrolled-up');cart.unfixElement()},};if(cart.scrollPos>50){cart.fixElement();if(cart.checkoutButtonPos<cart.screenHeight){cart.unfixElement()}}else{cart.unfixElement()}}},},created(){const self=this;peppercheckout.globals.$eventbus.$on('togglewishlistproduct',(payload)=>{const promise=self.$store.dispatch('togglewishlistproduct',payload);const style=payload.variantid;const{uniqueid}=payload;const{barcode}=payload;promise.then(()=>{self.activetab='wishlist';removeWishlistClass();$.each(self.$store.state.wishlist,(i,v)=>{addWishlistClass(v.uniqueid)});if(self.$store.state.wishlist.length>0){$('.icon-wishlist').addClass('is-active')}else{$('.icon-wishlist').removeClass('is-active')}
peppercheckout.globals.$eventbus.$emit('showcartslider')});promise.catch(()=>{if($('body').hasClass('is-unscrollable')){peppercheckout.globals.$eventbus.$emit('showcartslider')}
loadslidein('slide-in--login-register','/slide-in-login-register',{wishlisterror:1})})});peppercheckout.globals.$eventbus.$on('setactivetab',(payload)=>{self.activetab=payload.tab})},});const siteBasket=Vue.component('checkout-basket').extend({templateOverride:'#vc-component-checkout-basket',data(){return{showjustadded:!1,}},created(){this.showjustadded=this.$store.state.productjustadded},});const siteBasketItem=Vue.component('checkout-basket-item').extend({templateOverride:'#vc-component-checkout-basket-item',methods:{togglewishlistitem(pi_cartitemkey,ps_uniqueid){if(!this.isloggedin){window.location.href='/register'}else{this.$store.dispatch('togglewishlistitem',{cartitemkey:pi_cartitemkey,});addWishlistClass(ps_uniqueid)}},},});const siteCartSummary=Vue.component('cart-summary').extend({templateOverride:'#vc-component-cart-summary',});const siteDiscountCode=Vue.component('checkout-discount-code').extend({templateOverride:'#vc-component-checkout-discount-code',data(){return{toggled:!1,}},});const siteCheckoutOrderRows=Vue.component('checkout-order-rows').extend({templateOverride:'#vc-component-checkout-order-rows',});Vue.component('ps-cart-slider',siteCartSlider);Vue.component('checkout-basket',siteBasket);Vue.component('checkout-basket-item',siteBasketItem);Vue.component('checkout-discount-code',siteDiscountCode);Vue.component('cart-summary',siteCartSummary);Vue.component('checkout-order-rows',siteCheckoutOrderRows);new Vue({el:'#v-site-header',name:'Header',store:peppercheckout.cart.$store,created(){peppercheckout.globals.$eventbus.$on('showcartslider',()=>{$('body').addClass('is-unscrollable');$('body').addClass('is-hiding-hubspot')});peppercheckout.globals.$eventbus.$on('hidecartslider',()=>{$('body').removeClass('is-unscrollable');$('body').removeClass('has-cart-active');$('body').removeClass('is-hiding-hubspot')})},})}
var header={$siteHeader:$('.j-site-header'),offset:$('.j-promo').outerHeight()||0,height:$('.j-site-header').outerHeight(),updateLayoutDimensions(){header.offset=$('.j-promo').outerHeight()||0;header.height=header.$siteHeader.outerHeight()},positionHeader(){const lo_body=$('body');const li_scroll=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop);const lb_isSmallScreen=!lo_body.hasClass('desktop');header.updateLayoutDimensions();if(header.$siteHeader.is(':visible')){if(li_scroll>=header.offset){lo_body.addClass('has-fixed-header').css('padding-top',header.height);header.$siteHeader.addClass('is-fixed')}else{lo_body.removeClass('has-fixed-header').css('padding-top','');header.$siteHeader.removeClass('is-fixed')}}},init(){header.updateLayoutDimensions();header.positionHeader();$(window).on('resize scroll',$.throttle(header.positionHeader,10))},};header.init();var nav={$primaryNav:$('.j-primary-nav'),$accountNav:$('.j-account-nav'),$toggle:$('.j-toggle-navigation'),$subnavShow:$('.j-show-sub-nav'),$subnavHide:$('.j-hide-sub-nav'),$accountNavToggle:$('.j-toggle-account-nav'),$subnavTabToggles:$('.j-toggle-sub-nav-tabs'),$trendingProductsSlider:$('.j-trending-products-slider'),$featuredLinksSlider:$('.j-featured-links-slider'),$featuredProductsSlider:$('.j-featured-products-slider'),$overlay:$('.j-site-nav-overlay'),toggled:!1,show(){nav.toggled=!0;nav.$toggle.addClass('is-active').attr('aria-expanded','true');nav.$primaryNav.addClass('is-active');nav.showOverlay();$('body').addClass('has-nav-active');$('html, body').animate({scrollTop:header.$siteHeader.offset().top,});nav.hideHubSpot()},hide(){nav.toggled=!1;nav.$toggle.removeClass('is-active').attr('aria-expanded','false');nav.$primaryNav.removeClass('is-active');nav.hideOverlay();$('body').removeClass('has-nav-active');nav.showHubSpot()},showOverlay(){nav.$overlay.addClass('is-active').on('click',nav.hide)},hideOverlay(e){nav.$overlay.removeClass('is-active').off('click',nav.hide);nav&&nav.toggled&&nav.hide()},initMobileMenu(){$('[id$="-category"], [id$="-popular"]').addClass('is-active');nav.$subnavShow.on('click',nav.showSubNav);nav.$subnavHide.on('click',nav.hideSubNav)},destroyMobileMenu(){$('[id$="-category"], [id$="-popular"]').removeClass('is-active');nav.$subnavShow.off('click',nav.showSubNav);nav.$subnavHide.off('click',nav.hideSubNav);$('.j-sub-nav').removeAttr('style');nav.hide()},toggle(){if(nav.toggled){nav.hide()}else{nav.show();hj('trigger','mobile_nav_opened')}},toggleAccountNav(po_event){po_event.preventDefault();nav.$accountNav.toggleClass('is-active')},showSubNav(po_event){if(!$(this).parent('.s-nav__item').hasClass('has-sub-nav')){return}
po_event.preventDefault();nav.$primaryNav.addClass('has-sub-nav-active').scrollTop(0);$(this).closest('.has-sub-nav').addClass('is-active').children('.j-sub-nav').addClass('is-active')},hideSubNav(po_event){po_event.preventDefault();nav.$primaryNav.removeClass('has-sub-nav-active');$(this).closest('.has-sub-nav').removeClass('is-active').children('.j-sub-nav').removeClass('is-active')},toggleSubNavTab(){const lo_currentSubNav=$(this).closest('.j-sub-nav');lo_currentSubNav.find('.j-toggle-sub-nav-tab').attr('aria-expanded','false');lo_currentSubNav.find('.j-sub-nav-block').removeClass('is-active');$(this).attr('aria-expanded','true');$(`#${$(this).attr('aria-controls')}`).addClass('is-active')},showHubSpot(){$('body').removeClass('is-hiding-hubspot')},hideHubSpot(){$('body').addClass('is-hiding-hubspot')},initTrendingProductsSlider(){nav.$trendingProductsSlider.imagesLoaded(()=>{nav.$trendingProductsSlider.slick({arrows:!0,prevArrow:'<button type="button" data-role="none" class="slick-prev slick-arrow" aria-label="Previous" role="button" style=""><span class="icon-arrow-left"></span></button>',nextArrow:'<button type="button" data-role="none" class="slick-next slick-arrow" aria-label="Next" role="button" style=""><span class="icon-arrow-right"></span></button>',dots:!0,infinite:!0,slidesToShow:1,slidesToScroll:1,responsive:[{breakpoint:1200,settings:{arrows:!1,dots:!1,infinite:!1,slidesToShow:1.5,slidesToScroll:1,},}],});$(nav.$trendingProductsSlider).verticallyPosition();$(nav.$trendingProductsSlider).verticallyPosition({elem:'.slick-dots',position:'bottom',})})},initFeaturedLinksSlider(){nav.$featuredLinksSlider.imagesLoaded(()=>{nav.$featuredLinksSlider.slick({arrows:!1,dots:!1,infinite:!1,slidesToShow:2.5,slidesToScroll:2,})})},initFeaturedProductsSlider(){nav.$featuredProductsSlider.imagesLoaded(()=>{nav.$featuredProductsSlider.each(function(){const lo_container=$(this).closest('.j-featured-products');$(this).slick({arrows:!0,prevArrow:lo_container.find('.j-featured-products-prev-arrow'),nextArrow:lo_container.find('.j-featured-products-next-arrow'),appendDots:lo_container.find('.j-featured-products-dots'),dots:!0,slidesToShow:3,slidesToScroll:3,responsive:[{breakpoint:1200,settings:{arrows:!1,dots:!1,infinite:!1,slidesToShow:1.5,slidesToScroll:1,},}],})})})},init(){nav.initTrendingProductsSlider();nav.initFeaturedLinksSlider();nav.initFeaturedProductsSlider();enquire.register('screen and (max-width: 1200px)',{match:nav.initMobileMenu,unmatch:nav.destroyMobileMenu,setup:nav.destroyMobileMenu,});nav.$toggle.on('click',nav.toggle);nav.$accountNavToggle.on('click',nav.toggleAccountNav);nav.$subnavTabToggles.on('click','.j-toggle-sub-nav-tab',nav.toggleSubNavTab);$('.primary-nav').on('mouseenter',()=>{if($('body').hasClass('desktop')){nav.hideHubSpot()}});$('.primary-nav').on('mouseleave',()=>{if($('body').hasClass('desktop')){nav.showHubSpot()}})},};nav.init();$(document).on('click','.j-top',()=>{$('html, body').animate({scrollTop:0,},500)});enquire.register('screen and (max-width: 1200px)',{match(){$('.j-footer-nav-toggle').on('click.navtoggle',function(){$(this).toggleClass('is-active').next('.j-site-footer-nav').slideToggle()})},unmatch(){$('.j-footer-nav-toggle').removeClass('is-active').off('click.navtoggle');$('.j-site-footer-nav').removeAttr('style')},});$(document).on('submit','#j-footer-signup',function(e){e.preventDefault();processquicksignup($(this))});$(document).on('submit','#j-landingpage-signup',function(e){e.preventDefault();processquicksignup($(this))});$(document).on('submit','#j-welcome-signup',function(e){e.preventDefault();processquicksignup($(this))});function processquicksignup(_this){const _form=_this;const formAction=_this.attr('action');const formdata=_this.serializeArray();const lb_popup=_form.hasClass('j-welcomepopup');_form.find('.s-success, .s-error').html('').addClass('is-hidden');$.ajax({url:formAction,type:'post',dataType:'json',data:formdata,success(po_data){if(po_data.success){_form.find('.s-success').html(po_data.message).removeClass('is-hidden');subscribeTimer=setTimeout(()=>{_form.find('.s-success, .s-error').html('').addClass('is-hidden');_form[0].reset();_form.find('.s-success, .s-error').html('').addClass('is-hidden');if(lb_popup){liftcurtain()}},5000)}else if(po_data.message){_form.find('.s-error').html(po_data.message).removeClass('is-hidden')}},error(){},})}
const $promoslider=$('.j-promo');if($('.j-promo').length){if($promoslider.hasClass('slick-initialized')){return}
$promoslider.slick({autoplay:!0,infinite:!0,slidesToShow:1,slidesToScroll:1,arrows:!1,dots:!1,fade:!0,cssEase:'cubic-bezier(0.445, 0.050, 0.550, 0.950)',})}
$('.j-promo').on('beforeChange',function(){$(this).removeClass('is-loading')});$(document).on('click','.j-close-promo-top',function(e){$('.promo-bar--top').remove();$.get(`/promo-strip-close?p=${$(this).data('location')}`)});$(document).on('click','.j-close-promo-bottom',function(e){$('.promo-bar--bottom').remove();$.get(`/promo-strip-close?p=${$(this).data('location')}`)});$('.search-typeahead').on('scroll',()=>{const li_scrolltop=$('.search-typeahead').scrollTop();if(li_scrolltop>20&&!$('body').hasClass('desktop')){$('.search-typeahead__input').trigger('blur')}});$('.search-trigger-button').on('click',(e)=>{e.preventDefault();$('#search').attr('autofocus','autofocus');$('#search').trigger('focus')});$('.search-toggle').on('click',()=>{setTimeout(()=>{$('.search-trigger-button').trigger('click')},1000)});peppercontentjs.three={slidesToShow:1,slidesToScroll:1,infinite:!1,dots:!0,arrows:!1,};if(!(typeof peppercontentjs==='undefined')){$('.j-slider-product, .j-slider-collection').each(function(){const productRowId=this.id;new Vue({el:`#${productRowId}`,name:'ProductRow',data(){return{items:{},}},created(){this.items=window[productRowId].items},})});$('.j-slider-product').on('init',function(){$(this).verticallyPosition({image:'.s-image img',})});peppercontentjs.full.adaptiveHeight=!1;peppercontentjs.init()}
$('[class*=j-product-slider]').each(function(){let lo_slider;const lo_this=$(this);const ls_class=this.className.match(/j-product-slider--\d+/)[0];const li_number=parseInt(ls_class.charAt(ls_class.length-1));const li_numbertab=li_number>1?(li_number>2?(li_number-1):2):1;const li_numbermob=1;lo_slider={slidesToShow:li_number,arrows:!0,infinite:!1,prevArrow:'<button type="button" data-role="none" class="slick-prev slick-arrow" aria-label="Previous" role="button" style="display: inline-block;"></button>',nextArrow:'<button type="button" data-role="none" class="slick-next slick-arrow" aria-label="Next" role="button" style="display: inline-block;"></button>',responsive:[{breakpoint:1201,settings:{slidesToShow:li_numbertab,},},{breakpoint:751,settings:{slidesToShow:li_numbermob,},},],};lo_this.slick(lo_slider);lo_this.removeClass('is-loading')});const pcfourslider={tablet:{slidesToShow:3,arrows:!0,infinite:!1,dots:!0,arrows:!1,},mobile:{slidesToShow:1,arrows:!0,infinite:!1,dots:!0,arrows:!1,},};enquire.register('screen and (min-width: 1251px)',{match(){$('.j-fourslider').each(function(){if($(this).hasClass('slick-slider')){$(this).slick('unslick')}})},}).register('screen and (min-width: 751px) and (max-width: 1200px)',{match(){$('.j-fourslider').each(function(){if($(this).hasClass('slick-slider')){$(this).slick('unslick');$(this).slick(pcfourslider.tablet)}else{$(this).slick(pcfourslider.tablet)}})},}).register('screen and (min-width: 0px) and (max-width: 750px)',{match(){$('.j-fourslider').each(function(){if($(this).hasClass('slick-slider')){$(this).slick('unslick');$(this).slick(pcfourslider.mobile)}else{$(this).slick(pcfourslider.mobile)}})},});$('.j-slider-brands').on('init',()=>{$('.is-inverted').each(function(){$(this).find('img').invertImages()})});$('.s-video--video').each(function(index){const lo_this=$(this);const lo_video=lo_this.find('video');const lo_play=lo_this.find('.j-play-video');function pause(){lo_this.removeClass('is-playing');lo_video[0].pause()}
function play(){lo_this.addClass('is-playing');lo_video[0].play()}
window.onload=function(){lo_video[0].play().then(()=>{lo_video[0].play()}).catch(()=>{lo_video[0].play()})};lo_video.on('pause',()=>{pause()});lo_video.on('play',()=>{play()});lo_video.on('click',()=>{if(lo_this.hasClass('is-playing')){pause()}else{play()}})});$('.j-slc-checkbox').on('click',()=>{if($("input[name='slc-signup']").is(':checked')){$('.j-slc-button').removeClass('is-disabled')}else{$('.j-slc-button').addClass('is-disabled')}});var account={$creditButton:$('.j-expand-credit'),$wishlistRemove:$('.j-remove-wishlist-item'),expandCreditMob(){const lo_next=$(this).closest('.credit-table__row').next('.credit-table__row--expanded');const lo_chevron=$(this).closest('.credit-table__row').find('span');if(lo_next.css('display')=='table-row'){lo_next.hide();lo_chevron.removeClass().addClass('icon-chevron-down')}else{lo_next.show();lo_chevron.removeClass().addClass('icon-chevron-up')}},removeFromWishlist(e){e.preventDefault();const uniqueid=$(this).attr('data-uniqueid');peppercheckout.globals.$eventbus.$emit('togglewishlistproduct',{variantid:uniqueid});$(this).closest('.cat-item--wishlist').remove()},init(){account.$creditButton.on('click',account.expandCreditMob);account.$wishlistRemove.on('click',account.removeFromWishlist)},};account.init();function updateform(po_form,po_details){if(typeof po_details.resetform==='undefined'){po_details.resetform=!0}
if(typeof po_details.redirect==='undefined'){po_details.redirect=!1}
const formdata=po_form.serializeArray();const formAction=po_form.attr('action');const _form=po_form;_form.find('.s-success, .s-error').html('').addClass('is-hidden');_form.find('.has-error').html('').addClass('is-hidden');_form.find('.s-input.s-error--validation').removeClass('s-error--validation');$.ajax({url:formAction,type:'post',dataType:'json',data:formdata,success(po_data){if(po_data.success){_form.find('.s-success').html(po_data.message).removeClass('is-hidden');subscribeTimer=setTimeout(()=>{_form.find('.s-success, .s-error').html('').addClass('is-hidden');if(po_details.resetform){_form[0].reset()}
if(po_details.redirect!==!1){window.location.href=po_details.redirect}},3000)}else{lo_errors=po_data.errors;if(!$.isEmptyObject(lo_errors)){$.each(lo_errors,(name,value)=>{if(name=='dob'){_form.find('.dob-error').html(value).removeClass('is-hidden')}else if(name=='recaptcha'){_form.find('.recaptcha-error').html(value).removeClass('is-hidden')}else{_form.find(`input[name="${name}"]`).parent('.s-input').addClass('s-error--validation');_form.find(`input[name="${name}"]`).next('.has-error').html(value).removeClass('is-hidden')}})}
if(po_data.message){_form.find('.s-input-error').html(po_data.message).removeClass('is-hidden')}}},error(){},})}
$(document).on('click','.j-return-item',function(){loadpopup('popup-returns','/popup-returns',{i:$(this).data('orderid')})});$(document).on('click','.j-returns-next',function(e){e.preventDefault();const li_currentchild=$(this).closest('.returns-section').index()+1;const li_nextchild=parseInt(li_currentchild+1);const la_errors=[];let lb_itemselected=!1;let lb_hasonlysaleitem=!0;if(li_currentchild===1){$('.j-select-return-item').each(function(){if($(this).val()!==null&&$(this).val()!=''){lb_itemselected=!0;if($(this).attr('data-saleitem')!=1){lb_hasonlysaleitem=!1}}});if(lb_itemselected==!1){la_errors.push('Please select item(s) to return')}
if(lb_hasonlysaleitem){$('.j-refund-original-payment').addClass('is-hidden')}else{$('.j-refund-original-payment').removeClass('is-hidden')}}else if(li_currentchild===2){value=$("input[name='reason']").val();if(value==null||value==''){la_errors.push('Please choose a reason for your return')}}else if(li_currentchild===3){value=$("input[name='refundmethod']:checked").val();if(value===undefined){la_errors.push('Please select an option')}
if(value==='exchange'&&$('#exchange-textarea').val()==''){la_errors.push('Please advise what you would like to exchange for')}}
if(la_errors.length>0){errorElement=$(this).closest('.returns-section').find('.s-error');errorElement.html(la_errors.join('<br>'));errorElement.removeClass('is-hidden')}else{$('.s-error').addClass('is-hidden');if(li_currentchild!==4){$('.returns-section').removeClass('is-active');$(`.returns-section:nth-child(${li_nextchild})`).addClass('is-active')}}});$(document).on('click','.j-returns-previous',function(e){e.preventDefault();const li_currentchild=$(this).closest('.returns-section').index()+1;const li_prevchild=parseInt(li_currentchild-1);$('.returns-section').removeClass('is-active');$(`.returns-section:nth-child(${li_prevchild})`).addClass('is-active')});$(document).on('click','.j-update-order-history',function(e){e.preventDefault();const _this=$(this);const btnwrapper=_this.parent();btnwrapper.html('<div class="loader-wrap"><div class="loader"></div></div>');$.post('/_ps/api/customer/getprevorderhistory',{},(po_response)=>{if(po_response.success){btnwrapper.html('');location.reload()}else{btnwrapper.html(_this)}})});$(document).on('click','.page-laybuy .laybuy-question',function(e){$('.page-laybuy .laybuy-question').not(this).next('.laybuy-answer').slideUp();$('.page-laybuy .laybuy-question').not(this).removeClass('is-active');$(this).toggleClass('is-active');$(this).next('.laybuy-answer').slideToggle()});const text_max=200;$('#textarea-counter').html(`${text_max} / 200`);$('#gcMessage').keyup(()=>{const text_length=$('#gcMessage').val().length;const text_remaining=text_max-text_length;$('#textarea-counter').html(`${text_length} / 200`)});$('[class*=j-header-slider]').each(function(){let lo_slider;const lo_this=$(this);lo_slider={slidesToShow:1,arrows:!0,dots:!0,prevArrow:'<button type="button" data-role="none" class="slick-prev slick-arrow" aria-label="Previous" role="button" style="display: inline-block;"></button>',nextArrow:'<button type="button" data-role="none" class="slick-next slick-arrow" aria-label="Next" role="button" style="display: inline-block;"></button>',};lo_this.slick(lo_slider);lo_this.removeClass('is-loading')});const storage=window.localStorage;const ls_stylist=storage.getItem('stylist');$(document).on('click','.j-stylist-booking',()=>{storage.setItem('stylist','booking')});$(document).on('click','.j-stylist-profile',()=>{storage.setItem('stylist','profile')});if(ls_stylist!==null){if(ls_stylist==='booking'){$('.content').imagesLoaded(()=>{const li_element=$('iframe[src^="https://app.hubspot.com/meetings"]').offset().top;window.scrollTo(0,li_element);localStorage.removeItem('stylist')})}}}(jQuery))