(function($){window.ps=window.ps||{};ps.currentBreakpoint=null;ps.breakpoints={xl:1600,lg:1200,md:750,sm:360,nav:1280,};enquire.register(`screen and (min-width: ${ps.breakpoints.xl}px)`,{match(){ps.currentBreakpoint='xl'},}).register(`screen and (min-width: ${ps.breakpoints.lg}px) and (max-width: ${ps.breakpoints.xl - 1}px)`,{match(){ps.currentBreakpoint='lg'},}).register(`screen and (min-width: ${ps.breakpoints.md}px) and (max-width: ${ps.breakpoints.lg - 1}px)`,{match(){ps.currentBreakpoint='md'},}).register(`screen and (max-width: ${ps.breakpoints.md - 1}px)`,{match(){ps.currentBreakpoint='sm'},}).register(`screen and (max-width: ${ps.breakpoints.nav - 1}px)`,{match(){ps.navBreakpoint=!0},unmatch(){ps.navBreakpoint=!1},});function showDataLabel(e){if(typeof e==='object'){e.stopPropagation()}
$(this).closest('[data-label]').toggleClass('j-label',$(this).val()!=='')}
$.fn.showDataLabels=function(){return $(this).each(showDataLabel)};$('[data-label] input, [data-label] textarea, [data-label] select').showDataLabels();$(document).on('keyup','[data-label] input, [data-label] textarea',$.debounce(showDataLabel,100));$(document).on('change','[data-label] select',$.debounce(showDataLabel,100));$('.j-inc, .j-dec').on('click',function(){const $input=$(this).parent().find('input');const oldValue=$input.val();let newVal=0;if(button.hasClass('j-inc')){newVal=parseFloat(oldValue)+1}else{newVal=oldValue>0?parseFloat(oldValue)-1:0}
$input.val(newVal)});if(typeof Pikaday==='function'){const pickers={};$('.s-input-date-picker').each(function(index){const $input=$(this).find('input:first');const field=$(this).get(0);const picker=new Pikaday({field,input:$input,format:'D MMM YYYY',onSelect(){this._o.input.val(this.getDate().toLocaleDateString())},});$(this).data('picker-index',index);pickers[index]=picker;$(this).on('click',function(){const currentIndex=$(this).data('picker-index');const currentPicker=pickers[currentIndex];if(typeof currentPicker==='object'){currentPicker.show()}})})}
function preventTransitionOnResize(){const $body=$('body');let timeoutId=null;$body.addClass('is-resizing');clearTimeout(timeoutId);timeoutId=setTimeout(()=>{$body.removeClass('is-resizing')},1000)}
$(window).on('resize',$.throttle(preventTransitionOnResize,10));$(document).on('mouseup touchend',(e)=>{const lo_container=$('.nav-currency .dropdown-currency, .nav-currency');if(!lo_container.is(e.target)&&lo_container.has(e.target).length===0){$('.nav-currency .dropdown-currency').addClass('is-hidden');$('.nav-currency').removeClass('u-bold')}else{$('.nav-currency .dropdown-currency').removeClass('is-hidden');$('.nav-currency').addClass('u-bold')}});$(document).on('click','.j-mobile-currency',()=>{const element=$('.j-mobile-currency');const dropdown=$('.j-mobile-currency .dropdown-currency');enquire.register(`screen and (max-width: ${ps.breakpoints.nav - 1}px)`,{match(){if(dropdown.hasClass('is-hidden')){element.addClass('is-active');dropdown.removeClass('is-hidden');dropdown.css('bottom',element.height())}else{element.removeClass('is-active');dropdown.addClass('is-hidden');dropdown.removeAttr('style')}},})});$(document).on('click','.j-popup-example',()=>{$.popup.open({class:'ps-popup--example',url:'/popup-example',})});$(document).on('click','.j-popup-bottom-example',()=>{$.popup.open({class:'ps-popup--example ps-popup--bottom',url:'/popup-example',})});$(document).on('click','.j-slide-in-example',()=>{$.slideIn.open({class:'ps-slide-in--example',url:'/slide-in-example',})});$(document).on('click','.j-afterpay-popup',()=>{$.popup.open({class:'ps-popup--afterpay',url:'/popup-afterpay',})});$(document).on('click','.j-loading-popup',()=>{$.popup.open({class:'ps-popup--loader',url:'/popup-loader',})});if(window.welcomePopupKey||null){const popupDisplayedCookie=`${welcomePopupKey}PopupDisplayed`;let hasPopupDisplayed=$.getCookie(popupDisplayedCookie);if(forceWelcomePopup||null){hasPopupDisplayed=''}
if(hasPopupDisplayed===''){$.setCookie(popupDisplayedCookie,1,30);triggerWelcomePopup()}}
$('.j-popup-welcome').removeClass('is-hidden');$(document).on('submit','.j-welcome-popup-form',function(e){e.preventDefault();const form=$(this);const data=`${$(form).serialize()}&csrfAttribute=welcomepopup`;ajaxMailingListSubmit(form,data);return!1});$(document).on('click','.j-close-welcome-popup',()=>{$.setCookie('ps_welcomepopupclosed',1);$('.popup-welcome').addClass('is-hidden')});function triggerWelcomePopup(){setTimeout(()=>{$.popup.open({url:'/welcome-popup',class:'welcome-popup ps-popup--bottom',curtain:!1,})},200)}
function hidesearch(){$('.search-wrap').removeClass('is-active');$('.search-wrap input').val('');$('.j-search-results').hide();$('.j-search-results').html('')}
function showsearch(){$('.search-wrap').addClass('is-active');$('.search-wrap input').trigger('focus');$(document).on('keydown',(e)=>{if(e.key==='Escape'){hidesearch()}})}
$(document).on('click','.j-toggle-search',showsearch);$('html').on('click',(e)=>{const li_searchwrap=$(e.target).closest('.search-wrap').length;if(!li_searchwrap){hidesearch()}});const ls_searchstring=null;function delay(callback,ms){let timer=0;return function(){const context=this;const args=arguments;clearTimeout(timer);timer=setTimeout(()=>{callback.apply(context,args)},ms||0)}}
$(document).on('keyup','.form-search input',delay(function(event){const ls_search=$(this).val();if(ls_search.length<3){$('.j-search-results').hide();$('.j-search-results').html('');return}
$.getJSON(`/typeahead/${ls_search}`,(po_response)=>{if(po_response.data.dropdown===''){$('.j-search-results').hide();$('.j-search-results').html('');$('html, body').removeClass('u-no-scroll');return}
$('.search-result-content').show();$('.j-search-results').show();$('.j-search-results').html(po_response.data.dropdown)})},600));$(document).on('click','.clear-search-button',()=>{hidesearch();$('.form-search input').val('')});const locationselector={$wrap:$('.j-location-selector-strip'),$dropdown:$('.j-location-selector'),$close:$('.j-location-selector-strip-close'),$select:$('.j-location-selector-select li'),$siteContent:$('.j-wrapper'),$stickyHeader:$('.j-site-secondary-header'),select(){$('input[name="userselectedlocale"]').val($(this).attr('data-value'));$('.j-location-selector-selected').html($(this).html())},submit(){},toggle(){$(this).find('ul').slideToggle();$(this).toggleClass('is-active')},close(){locationselector.$wrap.remove();locationselector.$siteContent.css('margin-top',`${0}px`);locationselector.$stickyHeader.css('top',`${0}px`);createCookie('ps_localeswitcherclosed',1)},};if(typeof locationselector.$wrap!=='undefined'){const wrapHeight=locationselector.$wrap.outerHeight();locationselector.$siteContent.css('margin-top',`${wrapHeight}px`);locationselector.$stickyHeader.css('top',`${wrapHeight}px`)}
locationselector.$dropdown.on('click',locationselector.toggle);locationselector.$close.on('click',locationselector.close);locationselector.$select.on('click',locationselector.select);function createCookie(name,value,days){if(days){const date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires=`; expires=${date.toGMTString()}`}else var expires='';document.cookie=`${name}=${value}${expires}; path=/`}
$(document).on('click','.j-wishlist',function(po_event){po_event.preventDefault();po_event.stopPropagation();const _this=$(this);const stylecolourid=_this.data('styleid');const ls_removeclass='removewishlistitem';let lb_removefromwishlist=_this.hasClass(ls_removeclass);if(lb_removefromwishlist===!0){lb_removefromwishlist=1}else{lb_removefromwishlist=0}
if(stylecolourid!==''){$.post('/ajax-update-wishlist',{stylecolourid,},(po_response)=>{if(po_response.success){if(lb_removefromwishlist==1){$('.j-wishlist-alert a').html('Removed from wishlist');$('.j-wishlist-alert').addClass('is-showing');_this.html('<span class="icon-plus u-mr-4"></span>ADD TO WISHLIST');_this.removeClass(ls_removeclass)}else{$('.j-wishlist-alert a').html('Added to wishlist');$('.j-wishlist-alert').addClass('is-showing');_this.html('<span class="icon-minus u-mr-4"></span>REMOVE FROM WISHLIST');_this.addClass(ls_removeclass)}
setTimeout(()=>{$('.j-wishlist-alert').removeClass('is-showing')},2000)}else{window.location.assign('/log-in')}})}});$(document).on('click','.j-wl-remove',function(po_event){po_event.preventDefault();if(!confirm('Are you sure you want to remove this item from your wishlist?')){return!1}
const _self=$(this);const stylecolourid=$(this).data('styleid');$.post('/ajax-update-wishlist',{stylecolourid,},(po_response)=>{if(po_response.success){_self.closest('.ps-category-item').remove()}})});$(document).on('change','.j-wl-size-change',function(){const ls_upc=$(this).val();$(this).closest('.j-wl-item').find('.j-wl-atc').attr('data-upc',ls_upc)});$(document).on('click','.j-wl-atc',function(e){e.preventDefault();const li_upc=$(this).attr('data-upc');if(li_upc==''){return}
let extraoptions='';let extraoptionindex='';let extraoptionvalue='';$(this).closest('.j-wl-item').find('.j-extraoptionselector').each(function(){const label=$(this).data('label');const value=$(this).val();extraoptions+=`, ${label} - ${value}`;extraoptionindex+=`,${$(this).data('index')}`;extraoptionvalue+=`,${$(this).val()}`});const extras={extraoptions,extraoptionindex,extraoptionvalue,};peppercheckout.globals.$eventbus.$emit('addproducttocart',{variantid:li_upc,quantity:1,extras});if($(this).hasClass('j-ispopup')){liftcurtain()}});const checkoutOrderRowsCustom=Vue.component('checkout-order-rows').extend({templateOverride:'#vc-component-checkout-order-rows-custom',});const checkoutBasketItemCustom=Vue.component('checkout-basket-item').extend({templateOverride:'#vc-component-checkout-basket-item',});Vue.component('checkout-order-rows',checkoutOrderRowsCustom);Vue.component('checkout-basket-item',checkoutBasketItemCustom);if($('#v-site-header-secondary').length){new Vue({el:'#v-site-header-secondary',name:'SecondaryHeader',store:peppercheckout.cart.$store,})}
if($('#v-site-header').length){new Vue({el:'#v-site-header',name:'Header',store:peppercheckout.cart.$store,data(){return{isSearchActive:!1,isSearchTransitionActive:!1,}},methods:{showSearch(){this.isSearchActive=!0},hideSearch(){this.isSearchActive=!1},onSearchTransition(){$('body').toggleClass('has-search-active');this.isSearchTransitionActive=!this.isSearchTransitionActive;if(!this.isSearchActive){}},},mounted(){GlobalEventBus.$on('search:show',this.showSearch);GlobalEventBus.$on('search:hide',this.hideSearch)},})}
$(document).on('click','.co-cart .s-dropdown-styled',function(){$('.co-cart j-dropdown-styled').not(this).find('ul').slideUp();$(this).find('ul').slideToggle();$(this).toggleClass('is-active')});const nav={$sitePreHeader:$('.j-pre-header'),$siteHeader:$('.j-site-header'),$primaryNav:$('.j-primary-nav'),$siteNavLevel:$('.j-site-nav-level'),$subnavToggle:$('.j-toggle-subnav'),$toggle:$('.j-toggle-nav'),offset:$('.j-pre-header').outerHeight()||0,height:$('.j-site-header').outerHeight(),toggled:!1,events:{},show(){nav.toggled=!0;nav.$toggle.addClass('is-active').attr('aria-expanded','true');nav.$primaryNav.addClass('is-active');$('body').addClass('has-nav-active');nav.$primaryNav.slideDown(400,()=>{$('.j-mobile-extra-bot').css('opacity',1);$('.j-mobile-extra-currency').css('opacity',1)})},hide(){nav.$primaryNav.slideUp();$('.j-mobile-extra-bot').css('opacity',0);$('.j-mobile-extra-currency').css('opacity',0);nav.toggled=!1;nav.$toggle.removeClass('is-active').attr('aria-expanded','false');setTimeout(()=>{nav.$primaryNav.removeClass('is-active');$('body').removeClass('has-nav-active')},300)},initMobileMenu(){nav.$subnavToggle.on('click.subnav',nav.toggleSubNav);nav.$toggle.on('click',nav.toggle);nav.$siteNavLevel.hide();nav.$primaryNav.css('height',window.innerHeight-nav.$siteHeader.outerHeight()-nav.$sitePreHeader.outerHeight());nav.$primaryNav.find('.site-nav-primary__inner').css('height',window.innerHeight-nav.$siteHeader.outerHeight()-nav.$sitePreHeader.outerHeight())},destroyMobileMenu(){nav.$subnavToggle.off('click.subnav');nav.$toggle.off('click',nav.toggle);nav.$siteNavLevel.removeAttr('style');nav.$primaryNav.removeAttr('style');nav.$primaryNav.find('.site-nav-primary__inner').removeAttr('style');nav.hide()},toggle(){nav.toggled?nav.hide():nav.show()},toggleSubNav(e){e.preventDefault();$(this).closest('.has-subnav').toggleClass('is-active').find('.j-site-nav-level').slideToggle()},init(){enquire.register(`screen and (max-width: ${ps.breakpoints.nav - 1}px)`,{match:nav.initMobileMenu,unmatch:nav.destroyMobileMenu,})},destroy(){enquire.unregister(`screen and (max-width: ${ps.breakpoints.nav - 1}px)`,{match:nav.initMobileMenu,unmatch:nav.destroyMobileMenu,});nav.$subnavHide.off('click',nav.hideSubNav);nav.$subnavShow.off('click.subnav').off('mouseenter.subnav').off('mouseleave.subnav')},};$(nav.init);$(document).on('click','.j-close-promo',function(e){e.preventDefault();const promo=$(this).data('whichpromo');$(this).closest('.j-promo-bar').remove();$.post(`/ajax-content-update?a=hidepromobanner&p=${promo}`,()=>{})});if(countdowntimers==undefined){var countdowntimers=Array()}
const d=new Date();const countdownstart=parseInt(d.getTime()/1000);const setcountdowntimetimer=setInterval(()=>{const d=new Date();const diff=parseInt(d.getTime()/1000)-countdownstart;for(index in countdowntimers){const element=$(countdowntimers[index]);let remain=parseInt($(element).attr('data-remain'))-diff;remain=(remain>0)?remain:0;const days=0;const hours=parseInt(remain/3600);remain%=3600;const minutes=parseInt(remain/60);const seconds=(remain%60);let text='';if(days>0){text+=`${days} Day${(days > 1) ? 's' : ''} & `}
text+=`<span class='staticwidth-2'>${(`0${hours}`).slice(-2)}</span>`;text+=':';text+=`<span class='staticwidth-2'>${(`0${minutes}`).slice(-2)}</span>`;text+=':';text+=`<span class='staticwidth-2'>${(`0${seconds}`).slice(-2)}</span>`;$(element).html(text)}},1000);$('.j-footersubscribeform').on('submit',function(event){event.preventDefault();const form=$(this);const data=`${$(form).serialize()}&csrfAttribute=footer-subscribe`;ajaxMailingListSubmit(form,data);return!1});function ajaxMailingListSubmit(form,data){form.find('.j-error').addClass('is-hidden');form.find('.j-subscribesuccess').addClass('is-hidden');grecaptcha.ready(()=>{grecaptcha.execute(reCAPTCHA_site_key,{action:'submit'}).then((token)=>{data=`${data}&g-recaptcha-response=${token}`;console.log(data);$.ajax({url:'/ajax-mailing-list?a=subscribe',type:'post',dataType:'json',data,success(po_response){if(po_response.success){form.find('.j-subscribesuccess').removeClass('is-hidden').html('Thank you for subscribing.');form.trigger('reset')}else{$.each(po_response.errors,(field,message)=>{form.find(`.j-${field}_error`).removeClass('is-hidden').html(message)})}},})})})}
if(typeof peppercontentjs!=='undefined'){$('.j-slider-product').each(function(){const productRowId=this.id;const productRowVue=new Vue({el:`#${productRowId}`,name:'ProductRow',data(){return{items:{},}},created(){this.$nextTick(()=>{this.items=window[productRowId].items})},})});peppercontentjs.product.infinite=!0;peppercontentjs.product.centerMode=!1;peppercontentjs.product.centerPadding='0';peppercontentjs.product.slidesToShow=4;peppercontentjs.product.responsive=[{breakpoint:1201,settings:{slidesToShow:2,},},{breakpoint:751,settings:{slidesToShow:1,},},];peppercontentjs.three.centerPadding='50px';peppercontentjs.three.arrows=!0;if(!(typeof peppercontentjs==='undefined')){peppercontentjs.init()}}
$('.j-collapsible').collapsible();const collapsibleOnMobile=$('.j-collapsible-mobile');if(collapsibleOnMobile.length){enquire.register(`(max-width: ${ps.breakpoints.lg - 1}px)`,{match(){collapsibleOnMobile.collapsible()},unmatch(){collapsibleOnMobile.collapsible('destroy')},})}
$(document).on('submit','.j-login-form',function(e){e.preventDefault();const $form=$(this);const formData=$form.serializeArray();$form.find('.j-error, .j-form-error, .j-success').html('').addClass('is-hidden');$.ajax({url:'/api/login',type:'post',dataType:'json',data:formData,}).then((response)=>{const gaData={eventCategory:'Account',eventAction:'Login',eventLabel:'Account',};$(document).trigger('psevent',['accountLogin',gaData]);window.location.href='/my-account'}).catch((response)=>{const{errors}=response.responseJSON.data;if(!$.isEmptyObject(errors)){$.each(errors,(name,value)=>{if(name=='form'){$form.find('.j-form-error').html(value).removeClass('is-hidden')}else{$form.find(`[name="${name}"]`).siblings('.j-error').html(value).removeClass('is-hidden')}})}})});$(document).on('click','.j-customer-toggle',(e)=>{enquire.register(`(max-width: ${ps.breakpoints.md - 1}px)`,{match:()=>{$(e.currentTarget).toggleClass('is-showing')},})});function inpagenavtoggle(){if($('body').hasClass('desktop')){$('.j-menu-toggle').off('click.menu')}else{$('.j-menu').on('click.menu',()=>{const isActive=$('.j-menu-toggle').attr('aria-expanded')==='true';const menu=$(`#${$('.j-menu-toggle').attr('aria-controls')}`);const clonedMenu=menu.clone().appendTo('body').css('max-height','none');const maxHeight=clonedMenu.height()+32;clonedMenu.remove();$('.j-menu-toggle').attr('aria-expanded',!isActive);menu.toggleClass('is-active');if(isActive){menu.removeAttr('style')}else{menu.css('max-height',maxHeight)}})}}
inpagenavtoggle();function customercarenavscroll(){$(this).addClass('is-active');$('#menu-customer-care .s-menu__link').not(this).removeClass('is-active');localStorage.clear()}
$('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click(function(event){if($(this).parent().parent().hasClass('customer-care-nav-list')){console.log($(this));$(this).addClass('is-active');$('#menu-customer-care .s-menu__link').not(this).removeClass('is-active');localStorage.clear()}
if(location.pathname.replace(/^\//,'')===this.pathname.replace(/^\//,'')&&location.hostname===this.hostname){let target=$(this.hash);target=target.length?target:$(`[name=${this.hash.substr(1)}]`);if(target.length){event.preventDefault();$('html, body').animate({scrollTop:target.offset().top-$('.site-header').outerHeight()-24,},500)}}});$(document).on('click','[data-anchor]',function(e){e.preventDefault();const anchor=$(this).data('anchor');if(typeof(Storage)!=='undefined'){localStorage.setItem('customer-care-anchor',anchor)}
window.location.href=`/customer-care/#${anchor}`;console.log('yooo');localStorage.removeItem(anchor);return!1});const results={};function calculateVisibilityForDiv(div$){const windowHeight=$(window).height();const docScroll=$(document).scrollTop();const divPosition=div$.offset().top;const divHeight=div$.height();const hiddenBefore=docScroll-divPosition;const hiddenAfter=(divPosition+divHeight)-(docScroll+windowHeight);if((docScroll>divPosition+divHeight)||(divPosition>docScroll+windowHeight)){return 0}
let result=100;if(hiddenBefore>0){result-=(hiddenBefore*100)/divHeight}
if(hiddenAfter>0){result-=(hiddenAfter*100)/divHeight}
return result}
function calculateAndDisplayForAllDivs(){let maxInt=0;let maxObj=null;$('.content-section').each(function(){const currentSection=calculateVisibilityForDiv($(this));if(currentSection>maxInt){maxObj=this;maxInt=currentSection}});$(`[data-section!="${maxObj.id}"] a`).removeClass('is-active');$(`[data-section="${maxObj.id}"] a`).addClass('is-active')}
if($('.page-sectioned')[0]){$(document).on('scroll',()=>{calculateAndDisplayForAllDivs()});calculateAndDisplayForAllDivs();if(anchor=localStorage.getItem('customer-care-anchor')){let target=$(`.content-section#${anchor}`);$(`.s-menu__link[href="#${anchor}"]`).addClass('is-active');if(target.length===0)target=$(`a[name="${anchor.substr(1)}"]`);if(target.length===0)target=$('html');$('html, body').animate({scrollTop:target.offset().top-$('.site-header').outerHeight()-24},500)}
localStorage.clear()}
$(document).on('click','.j-sort-trigger',()=>{$('.j-filter-toggler').removeClass('is-active');$('.in-page-nav-filter__options').slideUp();$('.j-sort-trigger').toggleClass('is-active');$('.in-page-nav-sort__options').slideToggle()});$(document).on('click','.j-filter-toggler',()=>{$('.j-filter-toggler').toggleClass('is-active');$('.in-page-nav-filter__options').slideToggle();$('.j-sort-trigger').removeClass('is-active');$('.in-page-nav-sort__options').slideUp()});$(document).on('click','.j-toggle-orders',function(){$('.j-toggle-orders').removeClass('is-active');$(this).addClass('is-active');$('.j-order-row').addClass('is-hidden');const ls_type=$(this).data('type');$(`.j-filter-${ls_type}`).removeClass('is-hidden');$('.j-filter-word').html(ls_type)})}(jQuery))