(function($){window.ps=window.ps||{};ps.currentBreakpoint=null;ps.breakpoints={xl:1600,lg:1024,md:750,sm:360,nav:1280,};$(document).on('click','[data-layer]',function(event){dataLayer.push($(this).data('layer'));return!0});function showerrors(po_errors,po_parent){po_parent=po_parent||'';$('.p-inError').addClass('j-hidden');if(typeof po_errors!='object'){return!1}
for(var ls_field in po_errors){if(!po_errors.hasOwnProperty(ls_field)){continue}
var ls_error=po_errors[ls_field];if(po_parent.length>0){$(po_parent).find(`[data-for=${ls_field}]`).html(ls_error).removeClass('j-hidden')}else{$(`[data-for=${ls_field}]`).html(ls_error).removeClass('j-hidden')}}}
function setcookie(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toUTCString()}
document.cookie=name+"="+value+expires+"; path=/"}
function getcookie(ps_name){var name=ps_name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')
c=c.substring(1);if(c.indexOf(name)!=-1)return c.substring(name.length,c.length);}
return""}
function countcharactersleft(e){if(typeof e.data=='undefined'){e.data={};e.data.limit=$(this).data('limit');e.data.helptext=$(this).siblings('.j-helptext')}
var li_length=$(this).val().length;var li_left=e.data.limit-li_length;var ls_value=$(this).val();switch(e.key){case 'Backspace':case 'Delete':case 'Tab':case 'Enter':case 'LeftArrow':case 'UpArrow':case 'RightArrow':case 'DownArrow':break;default:if(li_left<0&&(e.key!=='Backspace'||e.key!=='Delete')){e.preventDefault();e.stopPropagation();$(this).val(ls_value.substring(0,e.data.limit));return!1}}
$(e.data.helptext).html(li_left+' characters left')}
$('.j-countcharacterleft').on('input',countcharactersleft);enquire.register('screen and (min-width: '+ps.breakpoints.xl+'px)',{match:function(){ps.currentBreakpoint='xl'},}).register('screen and (min-width: '+ps.breakpoints.lg+'px) and (max-width: '+(ps.breakpoints.xl-1)+'px)',{match:function(){ps.currentBreakpoint='lg'},}).register('screen and (min-width: '+ps.breakpoints.md+'px) and (max-width: '+(ps.breakpoints.lg-1)+'px)',{match:function(){ps.currentBreakpoint='md'},}).register('screen and (max-width: '+(ps.breakpoints.md-1)+'px)',{match:function(){ps.currentBreakpoint='sm'},}).register('screen and (max-width: '+(ps.breakpoints.nav-1)+'px)',{match:function(){ps.navBreakpoint=!0},unmatch:function(){ps.navBreakpoint=!1},});$('a[href*="#"]:not([href="#"])').on('click',function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var target=$(this.hash);target=target.length?target:$('[name='+this.hash.slice(1)+']');if(target.length){$('html, body').animate({scrollTop:target.offset().top-100},0);return!1}}});function mainImgSlider(){var mainImgSlider=$('.mainImage');if(!$('body').hasClass('mobile')){if(mainImgSlider.hasClass('slick-initialized')){mainImgSlider.slick('unslick')}}else{if(mainImgSlider.hasClass('slick-initialized')){return}else{mainImgSlider.slick({dots:!1,arrows:!0,prevArrow:'<div class="slick-prev"><img src="/content/images/arrow-left.png"></div>',nextArrow:'<div class="slick-next"><img src="/content/images/arrow-right.png"></div>',infinite:!1,slidesToShow:1,slidesToScroll:1})}}}
$(function(){if($('body').hasClass('mobile')){mainImgSlider()}});$(document).on('click','.s-dropdown-styled, .s-dropdown-border',(e)=>{$('.s-dropdown-styled, .s-dropdown-border').not(e.currentTarget).find('ul').slideUp();$(e.currentTarget).find('ul').slideToggle();$(e.currentTarget).toggleClass('is-active')});if(typeof peppercontentjs!=='undefined'){$('.j-slider-product').each(function(){var productRowId=this.id;if(!productRowId){return}
new Vue({el:'#'+productRowId,name:'ProductRow',store:peppercheckout.cart.$store,data:function(){return{items:{}}},created:function(){this.items=window[productRowId].items},mounted:function(){peppercheckout.globals.$eventbus.$on('showcartslider',function(){if(!window.ps.navBreakpoint){var siteHeaderMin=document.querySelector('.j-site-header.is-min-nav');if(siteHeaderMin){siteHeaderMin.classList.remove('is-min-nav')}}})}})});peppercontentjs.instagram.centerMode=!1;peppercontentjs.product.slidesToShow=4;peppercontentjs.product.responsive=[{breakpoint:1020,settings:{slidesToShow:3}},{breakpoint:751,settings:{slidesToShow:2}}];peppercontentjs.full.arrows=!1;peppercontentjs.full.adaptiveHeight=!1;peppercontentjs.init()}
function liftcurtain(){$(document).off('keydown.curtain');$('.p-popupCurtain, .p-popup').remove();$('body').removeClass('j-noScroll')}
function dropcurtain(ps_id){liftcurtain();$(document).on('keydown.curtain',function(po_event){if(po_event.key=='Escape'){liftcurtain()}});$(document.body).prepend('<div class="p-popupCurtain"></div><div class="loadingWrap p-popup '+ps_id+'"><img src="/content/images/loading.gif" alt="loading"></div>')}
$(document).on('click','.j-close-popup',function(){$.popup.close()})
function loadpopup(ps_id,ps_url,po_data=null,pf_callback=null){dropcurtain(ps_id);if(typeof pf_callback=='undefined'){pf_callback=''}
$.get(ps_url,po_data,function(po_response){$('.p-popup').html(po_response).removeClass('loadingWrap');var li_scrolltop=$(document).scrollTop();$('.p-popup').css('top','0px')}).done(pf_callback)}
$(document).on('click','.popupClose, .p-popupCurtain, .p-popupClose, .noThanks',function(e){e.preventDefault();liftcurtain()});$(document).on('click','.zoomBtn',function(){if(!$('body').hasClass('mobile')){var clickedimage=$(this).find('.mainImageChildren:not(.j-hidden)');loadpopup('zoomPop','/zoom-popup?i='+clickedimage.data('image')+'&p='+clickedimage.data('style')+'&c='+clickedimage.data('colour')+'&s='+clickedimage.data('size'))}});$('a[href*="#"]:not([href="#"])').on('click',function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var target=$(this.hash);target=target.length?target:$('[name='+this.hash.slice(1)+']');if(target.length){$('html, body').animate({scrollTop:target.offset().top-100},0);return!1}}});$(document).on('click','.j-login-slide-in',function(e){e.preventDefault();var gaData={eventCategory:'Home Page',eventAction:'Login',eventLabel:'Homepage',};$(document).trigger('psevent',['headerLoginClick',gaData]);$.slideIn.open({url:'/login-slide-in',class:'ps-slide-in--login'})});$(document).on('submit','#j-login-form',function(e){e.preventDefault();var loginForm=$(this);var formData=loginForm.serializeArray();loginForm.find('.j-email-error').addClass('is-hidden');loginForm.find('.j-password-error').addClass('is-hidden');loginForm.find('.j-form-error').addClass('is-hidden');$.ajax({url:'/customerapi/login',type:'post',dataType:'json',data:formData,success:function(response){if(response.status){var gaData={eventCategory:'Account',eventAction:'Login',eventLabel:'Account',};$(document).trigger('psevent',['accountLogin',gaData]);window.location.href='/my-account'}else{loginForm.find('.j-form-error').removeClass('is-hidden').html('Incorrect email or password')}},})});$(document).on('click','.j-password-slide-in',function(e){e.preventDefault();$.slideIn.open({url:'/password-slide-in',class:'password-slide-in'})});$(document).on('submit','#j-forgot-password-form',function(e){e.preventDefault();var forgotpasswordForm=$(this);var formData=forgotpasswordForm.serializeArray();forgotpasswordForm.find('.j-form-success').addClass('is-hidden');forgotpasswordForm.find('.j-email-error').addClass('is-hidden');forgotpasswordForm.find('.j-form-error').addClass('is-hidden');$.ajax({url:'/customerapi/forgotpassword',type:'post',dataType:'json',data:formData,success:function(response){if(response.status){forgotpasswordForm.find('#email').val('');forgotpasswordForm.find('.j-form-success').removeClass('is-hidden').html(response.data.message)}else{if(response.data.errors.form){forgotpasswordForm.find('.j-form-error').removeClass('is-hidden').html(response.data.errors.form)}else{if(response.data.errors.email){forgotpasswordForm.find('.j-email-error').removeClass('is-hidden').html(response.data.errors.email)}}}},})});$(document).on('submit','#j-reset-password-form',function(e){e.preventDefault();var resetpasswordForm=$(this);var formData=resetpasswordForm.serializeArray();resetpasswordForm.find('.j-password-error').addClass('is-hidden');resetpasswordForm.find('.j-repeatpassword-error').addClass('is-hidden');$.ajax({url:'/customerapi/resetpassword',type:'post',dataType:'json',data:formData,success:function(response){if(response.status){window.location.href='/my-account'}else{if(response.data.errors.form){resetpasswordForm.find('.j-form-error').removeClass('is-hidden').html(response.data.errors.form)}else{if(response.data.errors.password){resetpasswordForm.find('.j-password-error').removeClass('is-hidden').html(response.data.errors.password)}
if(response.data.errors.repeatpassword){resetpasswordForm.find('.j-repeatpassword-error').removeClass('is-hidden').html(response.data.errors.repeatpassword)}}}},})});var slideInLoginCloseTimeout=null;$(document).on('click','.login-slide-in button.j-close-slide-in',function(){window.clearTimeout(slideInLoginCloseTimeout);slideInLoginCloseTimeout=window.setTimeout(function(){if($.slideIn.instance){$.slideIn.close()}},500)});var slideInPasswordCloseTimeout=null;$(document).on('click','.password-slide-in button.j-close-slide-in',function(){window.clearTimeout(slideInPasswordCloseTimeout);slideInPasswordCloseTimeout=window.setTimeout(function(){if($.slideIn.instance){$.slideIn.close()}},500)});var password={toggleVisibility:function(){var $toggle=$(this);var $input=$toggle.prev();var isPassword=$input.attr('type')==='password';$input.attr('type',isPassword?'text':'password');$toggle.toggleClass('is-toggled')},};$(document).on('click','.j-password-toggle',password.toggleVisibility);$(window).on('scroll',function(){if($('main').length){var li_contentfromtop=$('main').offset().top,$window=$(window)}else{var li_contentfromtop=$('.content').offset().top,$window=$(window)}
if($window.scrollTop()>=li_contentfromtop){if(!$('header').hasClass('j-fixedNav')&&!$('.search-typeahead__input-wrap').length){var li_headerheight=$('header').innerHeight();$('main').css('margin-top',li_headerheight.toString());$('header').addClass('j-fixedNav')}}else{$('main').css('margin-top','0px');$('header').removeClass('j-fixedNav')}});function siteinfoslider(){var siteinfoslider=$('.siteInfoSlider');if($('body').hasClass('mobile')||$('body').hasClass('tablet')){if(siteinfoslider.hasClass('slick-initialized')){return}else{siteinfoslider.slick({infinite:!0,slidesToShow:1,slidesToScroll:1,arrows:!1,dots:!1,autoplay:!0,autoplaySpeed:2000})}}else{if(siteinfoslider.hasClass('slick-initialized')){siteinfoslider.slick('unslick')}}}
$(function(){$('.navIcon, .pageOverlay').on('click',function(){$('.navIcon').toggleClass('j-navIsX');$('.mainNavWrap').toggleClass('j-mobNavShowing');$('.pageOverlay').toggleClass('j-hidden');$('.j-fixedNav').toggleClass('j-mobNavShowing');$('body').toggleClass('j-noScroll');$('body').toggleClass('j-mobNavShowing')});$('.firstNavHead').on('click',function(){$('.firstNavHead').not(this).next('.secondNavOuter').find('.secondNav').slideUp();$('.firstNavHead').not(this).removeClass('j-firstNavActive');$(this).toggleClass('j-firstNavActive');$(this).next('.secondNavOuter').find('.secondNav').slideToggle()});var li_navHoverTimer=0;$(document).on('mouseenter','.firstNav >li',function(){if($('body').hasClass('desktop')){if($('.searchWrap').hasClass('j-hidden')){li_navHoverTimer=setTimeout(function(){$('.pageOverlay').removeClass('j-hidden')},300)}else{return}}else{return}});$(document).on('mouseover',function(e){if($('body').hasClass('desktop')){if($('.searchWrap').hasClass('j-hidden')){if($(e.target).closest('.firstNav >li').length===0){clearTimeout(li_navHoverTimer);$('.pageOverlay').addClass('j-hidden')}}else{return}}else{return}});var li_loginTimer=0;$(document).on('mouseenter','.accountIcon',function(){if($('body').hasClass('desktop')){li_loginTimer=setTimeout(function(){$('.dropdownloginWrap').removeClass('j-hidden')},300)}else{return}});$(document).on("click",".closeLogin",function(){$('.dropdownloginWrap').addClass('j-hidden')});siteinfoslider()
$(window).on("resize",function(){siteinfoslider()
if($('body').hasClass('desktop')){$('.navIcon').removeClass('j-navIsX');$('.mainNavWrap').removeClass('j-mobNavShowing');$('.pageOverlay').addClass('j-hidden');$('.j-fixedNav').removeClass('j-mobNavShowing');$('body').removeClass('j-noScroll');$('body').removeClass('j-mobNavShowing')}});$('.footerToggler').on("click",function(){if(ps.currentBreakpoint==='md'||ps.currentBreakpoint==='sm'){$('.footerToggler').not(this).next('ul').slideUp();$(this).next('ul').slideToggle()}else{return}});$('.closeSearch').on("click",function(){$('.typeaheadWrap').addClass('j-hidden');$('.searchWrap').addClass('j-hidden');$('.searchForm').find('input').val('');$('.pageOverlay').addClass('j-hidden');$('.pageOverlay').removeClass('disabled')});$(document).on("click",".matchSizeWrap",function(){$(this).find('ul').slideToggle('fast')});$(document).on("click",".matchColourWrap",function(){$(this).find('ul').slideToggle('fast')});$('.sizeWrap').on("click",function(){if($('body').hasClass('mobile')){return}else{$(this).find('ul').slideToggle('fast')}});$(".faqBlock .question").on('click',function(){$('.faqBlock .question').not(this).removeClass('j-faqActive');$('.faqBlock .question').not(this).next('.answer').slideUp();$(this).toggleClass('j-faqActive');$(this).next('.answer').slideToggle()});$(document).on("click",".regionList li",function(){$('.regionList li').not(this).removeClass('j-active');$(this).addClass('j-active');$('.regionTable').addClass('j-hidden');var tab=$(this).data('tab');$('.regionTable#'+tab).removeClass('j-hidden')});$('.faqListToggler').on("click",function(){$('.faqList').slideToggle()});$(".faqContent").hide();var activeTab=$('.faqList li.j-faqActive').attr("rel");$("#"+activeTab).show();$(".faqList li").on('click',function(){$(".faqContent").hide();var activeTab=$(this).attr("rel");$("#"+activeTab).fadeIn();var ls_url='/faq/'+activeTab;window.history.pushState('','',ls_url);$(".faqList li").removeClass("j-faqActive");$(this).addClass("j-faqActive");if(!$('body').hasClass('desktop')){$('.faqList').slideUp()}else{return}});$('#file').on('change',function(){if($(this).val()){var ls_filename=$(this).val();ls_filename=ls_filename.substring(ls_filename.lastIndexOf("\\")+1,ls_filename.length);$('.cvWrap').find('.filName').html(ls_filename)}});$(document).on('submit','.loginForm',function(e){e.preventDefault();var _self=this;$.post('/login',$(this).serializeArray(),function(po_response){if(po_response.status){location.href=location.href}
showerrors(po_response.errors,_self)})});$(document).on('submit','.newsletterForm',function(e){e.preventDefault();var _self=this;$.post('/general-process?a=newslettersignup',$(this).serializeArray(),function(po_response){$('.j-newslettermessage').addClass('j-hidden');if(po_response.status){$('.j-newslettermessage').html(po_response.data).removeClass('j-hidden');_self.reset();setTimeout(function(){liftcurtain()},2000)}
showerrors(po_response.errors,_self)})});if(!$('body').hasClass('mobile')){var ls_cookiename="firstvisit";var ls_cookie=getcookie(ls_cookiename);if(ls_cookie===""){setcookie(ls_cookiename,1,60*60*24*30*1000);setTimeout(function(){loadpopup('welcome',"/welcome-popup")},15000)}}
var ls_rewardscookiename="rewardsfirstvisit";var ls_cookierewards=getcookie(ls_rewardscookiename);if(ls_cookierewards===""){$('.mobileSignUpPrompt').removeClass('j-hidden')}
$(document).on('click','.closemobileSignUpPrompt',function(){setcookie(ls_rewardscookiename,1,60*60*24*30*1000);$('.mobileSignUpPrompt').addClass('j-hidden')});$(document).on('click','.welcomePopTrigger',function(){loadpopup('welcome-popup','/welcome-popup')})});if($('.j-timeline').length){var lo_timelineLeft=$('[data-aos="fade-right"]');enquire.register('screen and (max-width: 750px)',{match:function(){lo_timelineLeft.attr('data-aos','fade-left');AOS.refreshHard()},unmatch:function(){lo_timelineLeft.attr('data-aos','fade-right');AOS.refreshHard()},setup:function(){AOS.init({duration:600,easing:'ease-in-out',offset:200})}})}
var overrideCartSlider=Vue.component('ps-cart-slider').extend({templateOverride:'#vc-component-ps-cart-slider-custom',});Vue.component('ps-cart-slider',overrideCartSlider);new Vue({el:'#v-site-header',name:'Header',store:peppercheckout.cart.$store,data:function(){return{searchActive:!1,searchTransitionActive:!1,}},methods:{showSearch:function(){this.searchActive=!0;$('.searchWrap').toggleClass('j-hidden');$('.pageOverlay').removeClass('j-hidden');$('.pageOverlay').addClass('disabled')},hideSearch:function(){this.searchActive=!1},onSearchTransition:function(){$('body').toggleClass('has-search-active');this.searchTransitionActive=!this.searchTransitionActive;if(!this.searchActive){this.$nextTick(nav.reInit)}},},mounted:function(){GlobalEventBus.$on('search:show',this.showSearch);GlobalEventBus.$on('search:hide',this.hideSearch)},});new Vue({el:'#v-cart',store:peppercheckout.cart.$store});new Vue({el:'#v-cartslidertrigger',store:peppercheckout.cart.$store})}(jQuery))