define("CardLink",["jquery","ko","uiComponent","Vaimo_BauhausSe/js/resolutionProvider","touchDeviceIdentifier"],(($,ko,Component,resolutionProvider,touchIdentifier)=>{"use strict";const carousel=new class Carousel{carousels=[];processCarousel(el){const carousel=$(el).parents(".card-carousel").get(0);this.carousels.find((saved=>saved===carousel))||(this.carousels.push(carousel),$(carousel).on("productItemsCarouselInited",(e=>e.target.querySelectorAll(this.productLinkSelector).forEach((el=>{ko.cleanNode(el),ko.applyBindings(null,el)})))))}};return Component.extend({defaults:{productLinkSelector:"[data-product-link]",cards:[],clickEventName:touchIdentifier.click},initialize:function(){this._super(),window.addEventListener("breakpointsChanged",this._onBreakpointsChanged.bind(this))},_onBreakpointsChanged:function(){this.cards.filter((cardObj=>cardObj.active)).forEach((cardObj=>this.toggleProductLink(cardObj.sku,!0)))},onButtonClick:function(sku){return this._isDesktop()||this.toggleProductLink(sku,!0),!0},onButtonContext:function(sku){return this.toggleProductLink(sku),setTimeout(this.toggleProductLink.bind(this,sku,!0),25),!0},toggleProductLink:function(sku,toggle){this.cards.filter((cardObj=>cardObj.sku===sku)).forEach((cardObj=>{cardObj.card.setAttribute("href",toggle?cardObj.productUrl:cardObj.replacementUrl),cardObj.active=toggle}))},afterRender:function(el,sku,replacementUrl,productUrl){this._processCard(el,sku,replacementUrl,productUrl),carousel.processCarousel(el)},_processCard:function(el,sku,replacementUrl,productUrl){const card=$(el).parents(this.productLinkSelector).get(0);this.cards.find((cardObj=>cardObj.card===card))||this.cards.push({sku,card,replacementUrl,productUrl})},getTemplateObj:function(data){return{name:this.template,data:{$data:this,static:data||{}}}},_isDesktop:function(){return resolutionProvider.getResolution().isDesktop()}})})),define("vaimo/KOTemplateFromStringComponentExtension",["Magento_Ui/js/lib/knockout/template/loader"],(function(loader){return{getTemplateNameForCms:function(name,template){return window.define(loader.formatPath(name),[],(function(){return template||""})),name}}})),define("PassiveSticky",["Vaimo_BauhausSe/js/resolutionProvider","vaimo/headerState"],((resolutionProvider,headerState)=>{"use strict";const Sticky=function(options){this.options=Object.assign({nonMobResolution:"sm",headerStateEvents:["isMinicartActive","isSearchPopupOpened","isMobileMenuActive","isMinicartLoading","isModalOpened","isMyAccountOpened","isExpertService","isMontageService","isComplaintService"]},options),this.options.el&&(this._isDesktop()?window.addEventListener("breakpointsChanged",this._initOnResize.bind(this)):(this._init(),this._applyZIndex()))};return Sticky.prototype._toggleStickyness=function(){let state=!1;this.options.headerStateEvents.forEach((eventName=>state=state||headerState.getState(eventName))),this.options.el.classList.toggle(this.options.zIndexClass,state)},Sticky.prototype._applyZIndex=function(){this.options.headerStateEvents.forEach((eventName=>headerState.subscribe(eventName,this._toggleStickyness.bind(this)))),this._toggleStickyness()},Sticky.prototype._isDesktop=function(){return resolutionProvider.getResolution().isSizeActive(this.options.nonMobResolution)},Sticky.prototype._initOnResize=function(){this._isDesktop()||(document.removeEventListener("breakpointsChanged",this._initOnResize),this._init())},Sticky.prototype._init=function(){this.options.staticFixedPosition||(this._onElChanged(),document.addEventListener("scroll",this._setClasses.bind(this),{passive:!0}),window.addEventListener("updateBuyButtonState",this._onElChanged.bind(this)),window.addEventListener("BiSFormChanged",this._onElChanged.bind(this)),window.addEventListener("windowResize",this._onElChanged.bind(this),{passive:!0}))},Sticky.prototype._setClasses=function(){const isSticky=this.position.height+this.position.y>window.pageYOffset+window.innerHeight;this.isSticky!==isSticky&&(this.isSticky=isSticky,this.options.el.classList.toggle(this.options.stickyClass,isSticky),isSticky&&(this.options.placeholder.style.height=this.position.height+"px"),this._toggleDependentElClasses(isSticky))},Sticky.prototype._toggleDependentElClasses=function(isSticky){if(!this.options.dependentElSelector)return;const el=document.querySelector(this.options.dependentElSelector);if(!el)return clearTimeout(this.findElTimeout),void(this.findElTimeout=setTimeout((()=>this._toggleDependentElClasses(isSticky)),3e3));this.findElTimeout&&(clearTimeout(this.findElTimeout),this.findElTimeout=null),isSticky?el.classList.add(this.options.dependentElStickyClass):el.classList.remove(this.options.dependentElStickyClass)},Sticky.prototype._onElChanged=function(){this.isSticky=void 0,this._saveElPosition(),this._setClasses()},Sticky.prototype._saveElPosition=function(){this.options.el.classList.toggle(this.options.stickyClass,!1),this.position=this.options.el.getBoundingClientRect(),this.position.y=this.position.y+window.pageYOffset,this.options.placeholder.style.height=this.position.height+"px"},Sticky})),define("StoreLocatorStorage",["jquery","mage/cookies"],($=>{"use strict";return class Storage{constructor(cookieName,defaultValue){this.cookieName=cookieName,this.defaultValue=defaultValue,this.val=this.getBaseValue()}getBaseValue(){return $.cookie(this.cookieName)}set(val){this.val=val,val&&$.cookie(this.cookieName,val,{expires:1})}get(){return this.val}getDefault(){return this.defaultValue}}})),define("StoreLocatorStorageIsolated",["StoreLocatorStorage"],(StoreLocatorStorage=>class StorageIsolated extends StoreLocatorStorage{constructor(cookieName,checkoutConfig){const storeId=checkoutConfig.deliveryStoreId;super(cookieName,storeId),this.val=storeId}getBaseValue(){return this.val}get(){return this.val}getDefault(){return this.val}})),define("vaimo/animatedInputLabel",["jquery","jquery/ui"],($=>{"use strict";return window.triggerAnimatedInputs=function(el){var data={};el&&(data.$el=$(el)),$(document.body).trigger("animatedInputsProcess",data)},$.widget("vaimo.animatedInputLabel",{options:{inputSelector:".animated-input__input",classes:{labelActive:"animated-input__label--active",labelError:"animated-input__label--error",labelFocused:"animated-input__label--focused",inputFocused:"animated-input__input--focused",inputActive:"animated-input__input--active"}},_create:function(){$(this.bindPlaceholderActions.bind(this)),$(this.prepareInputLabels.bind(this));var bodyHandlers={};bodyHandlers.animatedInputsProcess=this.prepareInputLabels.bind(this),this._on("body",bodyHandlers)},prepareInputLabels:function(e,data){(data&&data.$el instanceof $?data.$el:$(this.options.inputSelector)).each(function(idx,input){var $label,$input=$(input);$label=this._$getLabelForInput($input),this._isLabelValid($label)&&!$input.hasClass(this.options.classes.inputFocused)&&(this._keepLabelActive($input,$label),this._keepLabelFocused($input,$label),$input.trigger("animatedInputsPrepared"))}.bind(this))},_isLabelValid:function($label){return 1===$label.length&&1!=$label.height()},bindPlaceholderActions:function(){var widget=this,widgetClasses=widget.options.classes,input=widget.options.inputSelector,skipBlurEventsList=["validation:result"];$("body").on("focus blur change validation:result",input,(function(e){var isBlur="blur"==e.type||"focusout"==e.type,isChange="change"===e.type,$input=$(this),isError=$input.hasClass("mage-error"),$label=widget._$getLabelForInput($input);widget._keepLabelActive($input,$label),$label.toggleClass(widgetClasses.labelError,isError),-1==$.inArray(e.type,skipBlurEventsList)&&($label.toggleClass(widgetClasses.labelFocused,!(isBlur||isChange&&!$input.val())),$input.toggleClass(widgetClasses.inputFocused,!(isBlur||isChange&&!$input.val()))),$input.trigger("animatedInputsActivated")}))},_$getLabelForInput:function($input){var $label=$input.closest("label"),inputId=$input.attr("id");return $label.attr("for")===inputId?$label:$('label[for="'+inputId+'"]')},_keepLabelActive:function($input,$label){var isChromeAutofill=!1;navigator.userAgent.toLowerCase().indexOf("chrome")>=0&&(isChromeAutofill=$input.is("*:-webkit-autofill")),$label.toggleClass(this.options.classes.labelActive,isChromeAutofill||!!$input.val()),$input.toggleClass(this.options.classes.inputActive,isChromeAutofill||!!$input.val())},_keepLabelFocused:function($input,$label){$label.toggleClass(this.options.classes.labelFocused,!!$input.val()),$input.toggleClass(this.options.classes.inputFocused,!!$input.val())}}),$.vaimo.animatedInputLabel})),define("price-format-config",[],(()=>window.vaimoConfigs["price-format-config"])),define("postcodeUtils",[],(()=>({format:function(val){const parts=[];let idx=0;try{const split=this.mask.split(this.postcodeMaskSplit);return 1===split.length?val:(split.forEach((function(item){const replacementLength=parseInt(item.match(/9{(\d)*?}/)[1]);parts.push(val.slice(idx,idx+replacementLength)),idx+=replacementLength})),parts.join(this.postcodeMaskSplit))}catch(e){console.error(e)}return val},mask:"9{3} 9{2}",validationLength:5,postcodeMaskSplit:" "}))),define("phoneUtils",["mage/translate"],($t=>({mask:"9{10}","validate-phone-local":{regex:/^07\d{8}$/,msg:$t("Please enter a valid mobile number, for example 0721111111")},code:""}))),define("cssTimeout",[],(()=>200)),define("fetch",[],(()=>{"use strict";const rbracket=/\[\]$/;function buildParams(prefix,obj,add){if(Array.isArray(obj))obj.forEach(((val,idx)=>{rbracket.test(prefix)?add(prefix,val):buildParams(prefix+"["+("object"==typeof val&&null!=val?idx:"")+"]",val,add)}));else if("object"==typeof obj)for(let name in obj)buildParams(prefix+"["+name+"]",obj[name],add);else add(prefix,obj)}return function(url,params){return(params=JSON.parse(JSON.stringify(params))).headers=Object.assign({"cache-control":"no-cache","content-type":"application/x-www-form-urlencoded; charset=UTF-8",pragma:"no-cache","x-requested-with":"XMLHttpRequest"},params.headers||{}),params.body&&(params.body=function convert(obj){let prefix,result=[],add=(key,value)=>{result[result.length]=encodeURIComponent(key)+"="+encodeURIComponent(null==value?"":value)};if(Array.isArray(obj))obj.forEach((el=>{add(el.name,el.value)}));else for(prefix in obj)buildParams(prefix,obj[prefix],add);return result.join("&")}(params.body)),params.method=params.method||"GET",fetch(url,params).then((response=>{if(!response.ok)throw new Error("Network response was not ok");return response.json()}))}})),define("vaimo/geolocationHelper",[],(function(){"use strict";const geolocationHelper=function(){this.earthRadius=6378137,this.errorMsgTimeout=6e3};return geolocationHelper.prototype.getUserLocation=function(successCb=()=>{},errCb=()=>{},options){navigator.geolocation.getCurrentPosition((position=>{const pos={lat:position.coords.latitude,lng:position.coords.longitude};successCb(pos)}),(e=>{errCb(e)}),Object.assign({timeout:this.errorMsgTimeout},options))},geolocationHelper.prototype.getDistance=function(p1,p2){const R=this.earthRadius,dLat=this._getRad(p2.lat-p1.lat),dLong=this._getRad(p2.lng-p1.lng),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(this._getRad(p1.lat))*Math.cos(this._getRad(p2.lat))*Math.sin(dLong/2)*Math.sin(dLong/2);return R*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},geolocationHelper.prototype._getRad=function(x){return x*Math.PI/180},new geolocationHelper})),define("vaimo/headerState",["jquery"],(function($){"use strict";let HeaderState=function(){this.defaultStateValue=!1,this.states=[],this.observers={}};return HeaderState.prototype.getState=function(name){return void 0!==this.states[name]?this.states[name]:this.defaultStateValue},HeaderState.prototype.setState=function(name,state){let stateWasChanged=this.getState(name)!==state;return this.states[name]=state,stateWasChanged&&this._fireStateChangedEvent(name,state),this},HeaderState.prototype._getObservers=function(name){return void 0!==this.observers[name]?this.observers[name]:[]},HeaderState.prototype._fireStateChangedEvent=function(name,newState){this._getObservers(name).forEach((cb=>cb(name,newState)))},HeaderState.prototype.subscribe=function(name,callbackFunction){return void 0===this.observers[name]&&(this.observers[name]=[]),this.observers[name].push(callbackFunction),this},HeaderState.prototype._validateState=function(expectedState,actualState){return"object"==typeof expectedState?-1!==$.inArray(actualState,expectedState):expectedState===actualState},HeaderState.prototype.subscribeMultiply=function(statesConfig,callbackFunction){$.each(statesConfig,function(name,expectedState){this.subscribe(name,function(expectedState,name,actualState){this._validateState(expectedState,actualState)&&callbackFunction()}.bind(this,expectedState))}.bind(this))},new HeaderState})),define("vaimo/lazyFactory",["jquery","jquery.lazy"],(function($){"use strict";const attrsMap={"data-src":"src","data-srcset":"srcset"};function onImageGetResponse(el,cb,val){cb(val),el.removeEventListener("load",onImageGetResponse),el.removeEventListener("error",onImageGetResponse),el.classList.add("pb-bauhaus-img__img-essence--loaded"),el.classList.remove("pb-bauhaus-img__img-essence--loading")}function fixDataAlts($imgs){$imgs.each((function(){let $el=$(this),alt=$el.attr("data-alt");alt&&$el.attr("alt",alt)}))}return $.fn.vaimoJqueryLazyFactory=function(options){return options=options||{},1===this.length&&this.data("lazyFactoryApplied")&&!options.forceReload||(this.data("lazyFactoryApplied",!0),this.each(((idx,el)=>{const $el=$(el),$images=$el.find("["+Object.keys(attrsMap).join("],[")+"]");$images.length&&(options.useComplicatedLazyLoad?function initHeavyLazy($el,$images,options){($el.is("picture")?$el:$images).lazy($.extend({delay:1},options,{onFinishedAll:function(){options&&options.onFinishedAll&&"function"==typeof options.onFinishedAll&&options.onFinishedAll.apply(this,arguments),fixDataAlts($images)}})),$images.on("load error",(function(){fixDataAlts($el)}))}($el,$images,options):function initLightLazy($el,$images,options){let counter=$images.length;$images.length||"function"!=typeof options.onFinishedAll?$images.each((function(){let $el=$(this);$el.on("load error",(function(){fixDataAlts($el),--counter||"function"==typeof options.onFinishedAll&&options.onFinishedAll()}));for(let i in attrsMap){let url=$el.attr(i);url&&($el.attr(attrsMap[i],url),$el.removeAttr(i))}})):options.onFinishedAll()}(0,$images,options))}))),this},$.lazy(["pictureLoader"],(function handleHeavyLazyPicture($el,responseCb){$el.find("[data-srcset]").each(((idx,el)=>{el.classList.add("pb-bauhaus-img__img-essence--loading"),function setSrcset(el){let srcset=el.getAttribute("data-srcset");srcset&&el.setAttribute(attrsMap["data-srcset"],srcset)}(el),"IMG"===el.tagName&&(el.addEventListener("load",onImageGetResponse.bind(null,el,responseCb,!0)),el.addEventListener("error",onImageGetResponse.bind(null,el,responseCb,!1)))}))})),$.fn.vaimoJqueryLazyFactory})),define("vaimoJqueryLazyFactory",["vaimo/lazyFactory"],(function(){return"vaimoJqueryLazyFactory"})),define("vaimo/lazyModalInit",["jquery","Magento_Ui/js/modal/modal","touchDeviceIdentifier","jquery/ui"],(function($,$modal,touchIdentifier){return $.widget("vaimo.lazyModalInit",{options:{openButtonSelector:$()||"",contentSelector:$(),modalOptions:{}},_destroy:function(){return this.$modalWidget&&this.$modalWidget.destroy(),this._super()},_initModalInstance:function($container){$modal($.extend({buttons:[]},this.options.modalOptions),$container),this.$modalWidget=$container.data("mageModal")},_create:function(){var buttonSelector=this.options.openButtonSelector;buttonSelector&&buttonSelector.length||(buttonSelector=this.element);var isInited=!1;this.$content=$(this.options.contentSelector);var eventObj={};eventObj[touchIdentifier.click]=function(){return isInited||(isInited=!0,this._initModalInstance(this.$content)),this.$content.modal("openModal"),!1},this._on(buttonSelector,eventObj)},getContent:function(){return this.$content}}),$.vaimo.lazyModalInit})),define("vaimoUtil/numberFormat",[],(function(){"use strict";var options_delimiter=",",options_precision=3;return{formatNumber:function(num){return"number"!=typeof num?num:num.toFixed(options_precision).replace(".",options_delimiter)}}})),define("vaimo/overlay-template",[],(()=>'<div class="loader-overlay" data-overlay-content>\n <div class="loader-overlay__wrapper">\n <div class="loader-overlay__grid"><% _.each(Array.apply(1, Array(9)), ()=>{ %>\n <div class="loader-overlay__cube"></div>\n <% }) %></div>\n <p class="loader-overlay__info"><%= obj.text %>…</p>\n </div>\n</div>')),define("vaimo/overlay",["underscore","vaimo/overlay-template","mage/translate"],((_,template,$t)=>new class Overlay{options={visibleClass:"loader-overlay--visible",contentSelector:"[data-overlay-content]"};activeIndexes=[];activeInlineContainers=[];templateObj={text:$t("Loading")};constructor(){this.template=_.template(template)}open(index){this.root||this._addRoot(),index&&this.activeIndexes.length||this.root.classList.add(this.options.visibleClass),index&&this._addIndex(index)}close(index){index&&0!==this.activeIndexes.length&&this._removeIndex(index),index&&0!==this.activeIndexes.length||this.root?.classList.remove(this.options.visibleClass)}openInline($el,cssClass){if($el?.length){if(-1!==this._getActiveElIndex($el))return;this.activeInlineContainers.push({$el,timeout:setTimeout(this.closeInline.bind(this,$el),6e4)});const loader=this._getLoaderEl();return loader.classList.add(cssClass),void $el.append(loader)}this.open()}closeInline($el){if($el?.length){const idx=this._getActiveElIndex($el);return-1!==idx&&this.activeInlineContainers.splice(idx,1),void $el.find(this.options.contentSelector).remove()}this.close()}isOpen(){return this.root?.classList?.contains(this.options.visibleClass)}_addIndex(index){this.activeIndexes.push(index)}_removeIndex(index){for(let i=0;i<this.activeIndexes.length;i++)this.activeIndexes[i]===index&&this.activeIndexes.splice(i,1)}_getActiveElIndex($el){return this.activeInlineContainers.findIndex((item=>item.$el.is($el)))}_getLoaderEl(){const el=document.createElement("template");return el.innerHTML=this.template(this.templateObj),el.content.firstChild}_addRoot(){this.root=this._getLoaderEl(),document.body.appendChild(this.root)}})),define("pb-img",["jquery","vaimo/lazyFactory","domReady!"],($=>{"use strict";$("[data-pb-img]").attr("data-loader","pictureLoader").vaimoJqueryLazyFactory({useComplicatedLazyLoad:!0,delay:-1,bind:"event"})})),define("registryChain",["uiRegistry"],(registry=>function(chain,cb){Promise.all(chain.map((name=>new Promise((resolve=>registry.get(name,resolve)))))).then((resolves=>cb.apply(null,resolves)))})),define("requireModule",[],(()=>class WakeUp{queue=[];set(options){this.isReady=!0,this.optionsForCb=options,this.queue.forEach(this._runCallback.bind(this))}_runCallback(cb){this.isReady?cb(this.optionsForCb):this.queue.push(cb)}load(name,req,onLoad){this._runCallback(onLoad)}})),define("saveTwitching",["jquery","Vaimo_BauhausSe/js/resolutionProvider","vaimo/headerState","domReady!"],(function($,resolutionProvider,headerState){"use strict";const Save=function(){this.ns=".saveTwitching",$(window).on("windowResize"+this.ns,this._setSize.bind(this)),headerState.subscribe("isModalOpened",this._onAfterNoScroll.bind(this)),$(document).on("afterDropdowndialogOpen"+this.ns,this._onAfterNoScroll.bind(this)),$(document).on("afterOpenModal"+this.ns,this._onAfterNoScroll.bind(this)),this._setSize()};return Save.prototype._onAfterNoScroll=function(){if(this.isProcessed)return;$(window).off(this.ns),$(document).off(this.ns),this.isProcessed=!0;const padding=document.body.offsetWidth-this.sizeBeforeNoScroll,style=document.createElement("style");style.innerText="@media only screen and (min-width: "+resolutionProvider.getResolution().getDesktopSize()+"px) {body._has-modal,body.save-twitching {padding-right:"+padding+"px}}",document.body.appendChild(style)},Save.prototype._setSize=function(){this.sizeBeforeNoScroll=document.body.offsetWidth},new Save})),define("js/simpleDropdown",["jquery","jquery/ui"],(function($){"use strict";var id=0;return $.widget("vaimo.simpleDropdown",{options:{dialogContentClass:"",wrapperElementSelector:"",triggerTarget:"",currentOption:"",timeout:100,dropDownOverlaySelector:"",stopToggleAttr:"data-link-block-event",dropDownOverlayActiveClass:"",modalClass:"save-twitching",modalBeforeTimeout:!1,noScroll:!1},_create:function(){this.eventId="."+this.widgetFullName+id++,this.$overlay=$(this.options.dropDownOverlaySelector),this.$wrapper=$(this.options.wrapperElementSelector),this.isOpened=!1,$("body").on("click"+this.eventId,this.options.triggerTarget,function(e){const $el=$(e.currentTarget);$el.attr(this.options.stopToggleAttr)||$el.parents().attr(this.options.stopToggleAttr)||(this.toggle(),this.activateCurrent($el))}.bind(this)).on("keydown"+this.eventId,function(e){27===e.keyCode&&this.close()}.bind(this)),this._on(this.$overlay,{click:this.close})},_destroy:function(){$("body").off(this.eventId),this.element.removeClass(this.options.dialogContentClass),this.$wrapper.hide(),this.$overlay.removeClass(this.options.dropDownOverlayActiveClass)},toggle:function(){this.isOpened?this.close():this.open()},open:function(options){this.isOpened||(clearTimeout(this.hideTimeout),this.element.trigger("dropdownBeforeOpen"),this.element.addClass(this.options.dialogContentClass),this.$wrapper.show(),this.$overlay.addClass(this.options.dropDownOverlayActiveClass),this.options.modalClass&&$("body").addClass(this.options.modalClass),this.isOpened=!0,this.element.trigger("dropdowndialogopen",{options}),this._toggleBodyState(!0),$(document).trigger("afterDropdowndialogOpen",this.modal))},_toggleBodyState:function(toggle){this.options.noScroll&&$("body").toggleClass("no-scroll",toggle)},close:function(){this.isOpened&&(clearTimeout(this.hideTimeout),this.element.removeClass(this.options.dialogContentClass),this.options.modalClass&&this.options.modalBeforeTimeout&&$("body").removeClass(this.options.modalClass),this.hideTimeout=setTimeout(function(){this.options.modalClass&&!this.options.modalBeforeTimeout&&$("body").removeClass(this.options.modalClass),this.$wrapper.hide(),this.element.trigger("dropdownAfterClose")}.bind(this),this.options.timeout),this.$overlay.removeClass(this.options.dropDownOverlayActiveClass),this.isOpened=!1,this.element.trigger("dropdowndialogclose"),this._toggleBodyState(!1))},activateCurrent:function($item){this.options.currentOption&&($("["+this.options.currentOption+"]").collapsible().collapsible("deactivate"),$("["+this.options.currentOption+"="+$item.attr(this.options.currentOption)+"]").collapsible("activate"))}}),$.vaimo.simpleDropdown})),define("js/store-select",["ko","uiComponent","vaimo/storeLocatorData","uiRegistry"],(function(ko,Component,storesData,registry){"use strict";return Component.extend({defaults:{workingDays:["monday","tuesday","wednesday","thursday","friday"]},initialize:function(){this._super(),this.observe(["currentStore","curStoreClosingTime","isClosed"]),this._updateStoreInfo(),storesData.listenStoreChange(this._updateStoreInfo.bind(this))},_updateStoreInfo:function(){const storeData=storesData.getCurrentStoreData();storeData&&(this.currentStore(storeData),this._updateHeaderTab())},_updateHeaderTab:function(){this.curStoreClosingTime(this._getTodayCloseTime())},_getTodayCloseTime:function(){const storeHours=this.currentStore().opening_hours;if(!storeHours?.length)return"";const specialCloseTime=this._getSpecialCloseTime();if(this.isClosed()||specialCloseTime)return specialCloseTime;const today=(new Date).toLocaleString("default",{weekday:"long"}).toLowerCase(),todayIsWorkingDay=this.workingDays.includes(today),hours=storeHours.find((data=>this.workingDays.includes(data.weekday)&&todayIsWorkingDay&&data.closes_at||!this.workingDays.includes(data.weekday)&&data.weekday===today));return hours?.closes_at||""},_getSpecialCloseTime:function(){const specialHours=this.currentStore().special_hours;if(!specialHours?.length)return"";const today=(new Date).toISOString().split("T")[0],todaySpecial=specialHours.find((day=>day.date===today));return this.isClosed(todaySpecial&&!todaySpecial?.opens_at),todaySpecial?.closes_at},openPopup:function(){registry.set("initStoreSelectPopup",!0),registry.get("storeLocatorPopup",(component=>component.showStoresListPopup()))}})})),define("vaimo/storeLocatorData",["vaimo/geolocationHelper","storeLocatorRequest!"],((geolocationHelper,options)=>new class{constructor(){this.storesUpdatesListeners=[],this.storeChangeListeners=[],this.storage=options.storage,this._setStores(options.stores),window.addEventListener("focus",(()=>{this.setStore(this.storage.getBaseValue())}))}setStore(val){this._isStoreAvailable(val)||(val=void 0),parseInt(this.storage.get())!==parseInt(val)&&(this.storage.set(val),this.storeChangeListeners.forEach((listener=>listener.cb(val))))}getStoreId(){const selectedStore=this.storage.get();return selectedStore||(this.storage.getDefault()||void 0)}getStoreDataById(id){for(let i=0;i<this.stores.length;i++)if(parseInt(this.stores[i].i)===parseInt(id))return JSON.parse(JSON.stringify(this.stores[i]));return null}isStoreLocalAvailable(storeData){const stockAvailable=(storeData=storeData||this.getCurrentStoreData())&&storeData.lo;return!stockAvailable||1===parseInt(stockAvailable)}getCurrentStoreName(){try{return this.getCurrentStoreData().n}catch(e){}return""}getCurrentStoreData(){return this.getStoreDataById(this.getStoreId())}getStoresTemplate(){return options.storesTemplateString}getStoresInfoTemplate(){return options.storesInfoTemplateString}getStores(){return JSON.parse(JSON.stringify(this.stores))}listenStores(cb){this.storesUpdatesListeners.push(cb)}listenStoreChange(cb){this.storeChangeListeners.push({cb})}_setStores(stores){this.stores=stores||[],this.stores.forEach((store=>store.stock_qty=store.stock_qty||0)),this.storesUpdatesListeners.forEach((cb=>cb(JSON.parse(JSON.stringify(this.stores)))));const storeId=this.getStoreId();storeId||this._setStoreIdByUserLocation(),this.setStore(storeId)}updateStores(filterStores){this.stockQtySet=!0,this._setStores(this.stores.reduce(((result,store)=>{for(let i=0;i<filterStores.length;i++)if(parseInt(filterStores[i].entity_id)===parseInt(store.i)||parseInt(filterStores[i].i)===parseInt(store.i)){const item=Object.assign({stock_meta_info:{}},store,filterStores[i]);return result.push(item),result}return result}),[]))}getStockQtySet(){return this.stockQtySet}_isStoreAvailable(storeId){for(let i=0;i<this.stores.length;i++)if(parseInt(this.stores[i].i)===parseInt(storeId))return!0;return!1}_setStoreIdByUserLocation(){if(options.isGeoOff||!this._getIsLocationRequestAllowed())return;geolocationHelper.getUserLocation((userLocation=>{if(this.storage.get())return;let closestStore,closestStoreDistance;this.stores.forEach((store=>{const distance=geolocationHelper.getDistance(userLocation,{lat:store.lat,lng:store.lng});closestStoreDistance<distance||(closestStoreDistance=distance,closestStore=store)})),this.setStore((closestStore||this.stores[0]).i)}),(e=>{console.log("Geolocation error:",e),3!==e.code&&localStorage.setItem("location-request-timeout",new Date(Date.now()+864e5).toString())}))}_getIsLocationRequestAllowed(){const date=localStorage.getItem("location-request-timeout");return!(date&&!(new Date(date)<new Date))}})),define("storeLocatorRequest",["underscore","jquery","requireModule","uiRegistry"],((_,$,requireModule,registry)=>{"use strict";const storeLocatorRequest=new requireModule;return registry.get("storeLocatorRequestData",(options=>{$.ajax({type:"GET",url:options.url,cache:!0}).done((stores=>storeLocatorRequest.set(Object.assign(options,{stores,storesTemplateString:_.template(options.storesTemplateString),storesInfoTemplateString:_.template(options.storesInfoTemplateString),isGeoOff:options.isGeoOff}))))})),storeLocatorRequest}));