!function(){function e(e,t,r){return t=o(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,r||[],o(e).constructor):t.apply(e,r))}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r0&&(n=n.substring(0,i)),n.substring(0,r-1)+e.ELLIPSIS}}])}();i(k,"ELLIPSIS","…");var P=function(){function e(){t(this,e)}return n(e,null,[{key:"isString",value:function(e){return"string"==typeof e}},{key:"isNotString",value:function(t){return!e.isString(t)}},{key:"isNotEmpty",value:function(t){return!e.isEmpty(t)}},{key:"isEmpty",value:function(t){return null==t||"null"===t||0===e._removeWhiteSpaces(t).length}},{key:"contains",value:function(t,r){return!e.isEmpty(t)&&!e.isEmpty(r)&&t.indexOf(r)>=0}},{key:"startsWith",value:function(t,r){return!e.isEmpty(t)&&!e.isEmpty(r)&&t.startsWith(r)}},{key:"endsWith",value:function(t,r){return!e.isEmpty(t)&&!e.isEmpty(r)&&t.endsWith(r)}},{key:"replaceLast",value:function(t,r,n){if(e.isEmpty(t)||e.isEmpty(r))return t;var i=t.lastIndexOf(r);return-1!==i?t.substring(0,i)+n:t}},{key:"_removeWhiteSpaces",value:function(e){return null==e?e:e.replace(/ /g," ").trim()}},{key:"reverse",value:function(e){for(var t="",r=e.length-1;r>=0;r--)t+=e[r];return t}},{key:"padEnd",value:function(e,t,r){if(e.length>=t)return e;for(var n=e;n.length=12}}])}(),R=function(){function e(){t(this,e)}return n(e,null,[{key:"isSafariMobile",value:function(){return(/iPhone/.test(navigator.userAgent)||/iPad/.test(navigator.userAgent))&&/AppleWebKit/.test(navigator.userAgent)}},{key:"isMobile",value:function(){var t=navigator.userAgent||navigator.vendor||window.opera;return e.MOBILE_FULL_PATTERN.test(t)||e.MOBILE_SHORT_PATTERN.test(t.substr(0,4))}},{key:"isNotMobile",value:function(){return!e.isMobile()}},{key:"isIOS",value:function(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}},{key:"isTablet",value:function(){return e.isGenericTablet()||e.isRecentIosTablet()}},{key:"isGenericTablet",value:function(){var t=navigator.userAgent||navigator.vendor||window.opera;return e.TABLET_PATTERN.test(t)}},{key:"isRecentIosTablet",value:function(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}},{key:"isDesktop",value:function(){return!e.isMobileOrTablet()}},{key:"isMobileOrTablet",value:function(){return e.isMobile()||e.isTablet()}},{key:"isMobileOrTabletPortrait",value:function(){return e.isMobile()||e.isTablet()&&e.isPortrait()}},{key:"isPortrait",value:function(){return window.matchMedia("(orientation: portrait)").matches}},{key:"isChrome",value:function(){return/Chrome\/\d/.test(navigator.userAgent)&&!/Edg\/\d/.test(navigator.userAgent)}},{key:"isFirefox",value:function(){return/Firefox/.test(navigator.userAgent)}},{key:"isSafari",value:function(){return/Safari/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Edg\/\d/.test(navigator.userAgent)}},{key:"isIEBefore9",value:function(){return document.all&&!document.addEventListener}},{key:"isIE9",value:function(){return navigator.appVersion&&navigator.appVersion.indexOf("MSIE 9.")>0}},{key:"isIE",value:function(){return navigator.appVersion&&(navigator.appVersion.indexOf("MSIE")>0||navigator.appVersion.indexOf("Trident")>0)}},{key:"getLanguage",value:function(){return window.navigator.language}}])}();i(R,"MOBILE_FULL_PATTERN",/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i),i(R,"MOBILE_SHORT_PATTERN",/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i),i(R,"TABLET_PATTERN",/android|ipad|playbook|silk/i);var x=function(){return n(function e(r,n,i,o,a,s,u,c,l,h,d,f,y,m,p,v,_,g,C,E,S,k,P,b,T){t(this,e),this.showMenuButton=r,this.positionType=n,this.target=i,this.targetPlacement=o,this.fixedPosition=a,this.horizontalOffset=s,this.verticalOffset=u,this.mobilePositionType=c,this.mobileTarget=l,this.mobileTargetPlacement=h,this.mobileFixedPosition=d,this.mobileHorizontalOffset=f,this.mobileVerticalOffset=y,this.menuShortNames=m,this.colour=p,this.bgColour=v,this.showBorder=_,this.borderColour=g,this.menuAdditionalStyles=C,this.showFlag=E,this.menuFlagSize=S,this.showCurrency=k,this.showArrow=P,this.whiteArrow=b,this.shopCurrency=T},[{key:"isFixed",value:function(){return R.isMobileOrTabletPortrait()&&this.mobilePositionType?"FIXED"==this.mobilePositionType:"FIXED"==this.positionType}},{key:"isFixedAtBottom",value:function(){var e=this.mobileFixedPosition?this.mobileFixedPosition:this.fixedPosition,t=R.isMobileOrTabletPortrait()?e:this.fixedPosition;return this.isFixed()&&-1!=["BOTTOM_LEFT","BOTTOM_RIGHT"].indexOf(t)}},{key:"isFixedAtRight",value:function(){var e=this.mobileFixedPosition?this.mobileFixedPosition:this.fixedPosition,t=R.isMobileOrTabletPortrait()?e:this.fixedPosition;return this.isFixed()&&-1!=["TOP_RIGHT","BOTTOM_RIGHT"].indexOf(t)}}])}(),N=function(){function e(r,n){t(this,e),this.priceFormat=r?r.trim():"",this.priceFormatWithCurrency=n?n.trim():""}return n(e,[{key:"getFormat",value:function(){var e=this._isPlainFormat()?this.priceFormat:this._trimFormat(this.priceFormat);return this._unescapeHtmlEntities(e)}},{key:"getFormatWithCurrency",value:function(){var e=this._isPlainFormatWithCurrency()?this.priceFormatWithCurrency:this._trimFormat(this.priceFormatWithCurrency);return this._unescapeHtmlEntities(e)}},{key:"_trimFormat",value:function(t){return t.replace(/\s*>\s*/g,e.END_TAG_PATTERN).replace(/\s*<\s*/g,e.START_TAG_PATTERN)}},{key:"_unescapeHtmlEntities",value:function(e){var t=document.createElement("p");return t.innerHTML=e,t.textContent}},{key:"_isPlainFormat",value:function(){return this._isPlain(this.priceFormat)}},{key:"_isPlainFormatWithCurrency",value:function(){return this._isPlain(this.priceFormatWithCurrency)}},{key:"_isPlain",value:function(t){if(t)return-1===t.indexOf(e.START_TAG_PATTERN);throw new Error("The price format must not be null")}}])}();i(N,"START_TAG_PATTERN","<"),i(N,"END_TAG_PATTERN",">");var I=function(){return n(function e(r){t(this,e),this.customCss=r.custom_css,this.customJs=r.custom_js;var n=r.preferences[0];this.amountBoxShowFlag=n.amount_box_show_flag,this.amountBoxFlagSize=n.amount_box_flag_size,this.amountBoxShowCurrencyCode=n.amount_box_show_currency_code,this.amountBoxColour=n.amount_box_colour,this.amountBoxBgColour=n.amount_box_bg_colour,this.amountBoxShowBorder=n.amount_box_show_border,this.amountBoxBorderColour=n.amount_box_border_colour,this.amountBoxAdditionalStyles=n.amount_box_additional_styles,this.cartNoteAdditionalStyles=n.cart_note_additional_styles,this.cartNoteText=n.cart_note_text,this.addTrackingAttributes=n.add_tracking_attributes,this.chooserCurrencies=n.chooser_currencies,this.defaultCurrency=n.default_currency,this.autodetectedCurrencyAvailable=n.autodetected_currency_available,this.chooserAdditionalStyles=n.chooser_additional_styles,this.chooserFlagSize=n.chooser_flag_size,this.chooserItemAdditionalStyles=n.chooser_item_additional_styles,this.chooserShortNames=n.chooser_short_names,this.mainBgColour=n.main_bg_colour,this.mainBorderColour=n.main_border_colour,this.mainColour=n.main_colour,this.whiteArrow=n.white_arrow,this.menuAdditionalStyles=n.menu_additional_styles,this.menuBgColour=n.menu_bg_colour,this.menuBorderColour=n.menu_border_colour,this.menuShowFlag=n.menu_show_flag,this.menuFlagSize=n.menu_flag_size,this.menuColour=n.menu_colour,this.menuShortNames=n.menu_short_names,this.menuShowBorder=n.menu_show_border,this.menuShowCurrency=n.menu_show_currency,this.menuShowArrow=n.menu_show_arrow,this.menuWhiteArrow=n.menu_white_arrow,this.replacePrices=n.replace_prices,this.rounding=n.rounding,this.roundOnlyConverted=n.round_only_converted,this.roundTo99=n.round_to99,this.showChooser=n.show_chooser,this.showMenuButton=n.show_menu_button,this.shopName=n.shop_name,this.priceFormat=new N(n.money_format,n.money_with_currency_format),this.shopCountry=n.shop_country,this.shopCurrency=n.shop_currency,this.activeCurrency=n.active_currency,this.enabledPresentmentCurrencies=n.enabled_presentment_currencies,this.currencies=n.currencies,this.autodetectedCurrency=n.autodetected_currency,this.customerCountry=n.customer_country,this.checkDynamicPrices=n.check_dynamic_prices,this.customDiscountedPriceSelectors=P.fixCommaSeparatedList(n.custom_discounted_price_selectors),this.customSimplifiedPriceSelectors=P.fixCommaSeparatedList(n.custom_simplified_price_selectors),this.customIgnoredPriceSelectors=P.fixCommaSeparatedList(n.custom_ignored_price_selectors),this.customTextNodePriceSelectors=P.fixCommaSeparatedList(n.custom_text_node_price_selectors),this.convertSelectors=P.fixCommaSeparatedList(n.convert_selectors),this.positionType=n.position_type,this.target=n.target,this.targetPlacement=n.target_placement,this.fixedPosition=n.fixed_position,this.horizontalOffset=n.menu_horizontal_offset,this.verticalOffset=n.menu_vertical_offset,this.mobilePositionType=n.mobile_position_type,this.mobileTarget=n.mobile_target,this.mobileTargetPlacement=n.mobile_target_placement,this.mobileFixedPosition=n.mobile_fixed_position,this.mobileHorizontalOffset=n.menu_mobile_horizontal_offset,this.mobileVerticalOffset=n.menu_mobile_vertical_offset,this.cartNoteTarget=n.cart_note_target,this.cartNoteTargetPlacement=n.cart_note_target_placement,this.cartNoteMobileTarget=n.cart_note_mobile_target,this.cartNoteMobileTargetPlacement=n.cart_note_mobile_target_placement,this.appTranslationSupport=n.app_translation_support,this._build()},[{key:"_build",value:function(){this.currencyConversionRatiosSingleton=new b(this.currencies,this.autodetectedCurrency),this.cartPreferencesSingleton=new T(this.cartNoteText,this.addTrackingAttributes,this.cartNoteAdditionalStyles,this.shopName,this.shopCurrency,this.activeCurrency,this.cartNoteTarget,this.cartNoteTargetPlacement,this.cartNoteMobileTarget,this.cartNoteMobileTargetPlacement),this.amountBoxPreferencesSingleton=new A(this.amountBoxColour,this.amountBoxBgColour,this.amountBoxShowBorder,this.amountBoxBorderColour,this.whiteArrow,this.showChooser,this.amountBoxAdditionalStyles,this.amountBoxShowFlag,this.amountBoxFlagSize,this.amountBoxShowCurrencyCode,this.replacePrices),this.currencyChooserPreferencesSingleton=new w(this.showChooser,this.replacePrices,this.chooserCurrencies,this.autodetectedCurrencyAvailable,this.currencyConversionRatiosSingleton,this.chooserShortNames,this.shopCurrency,this.autodetectedCurrency,this.mainColour,this.mainBgColour,this.mainBorderColour,this.chooserAdditionalStyles,this.chooserFlagSize,this.chooserItemAdditionalStyles),this.currencyButtonPreferencesSingleton=new x(this.showMenuButton,this.positionType,this.target,this.targetPlacement,this.fixedPosition,this.horizontalOffset,this.verticalOffset,this.mobilePositionType,this.mobileTarget,this.mobileTargetPlacement,this.mobileFixedPosition,this.mobileHorizontalOffset,this.mobileVerticalOffset,this.menuShortNames,this.menuColour,this.menuBgColour,this.menuShowBorder,this.menuBorderColour,this.menuAdditionalStyles,this.menuShowFlag,this.menuFlagSize,this.menuShowCurrency,this.menuShowArrow,this.menuWhiteArrow,this.shopCurrency)}},{key:"cartPreferences",value:function(){return this.cartPreferencesSingleton}},{key:"amountBoxPreferences",value:function(){return this.amountBoxPreferencesSingleton}},{key:"currencyChooserPreferences",value:function(){return this.currencyChooserPreferencesSingleton}},{key:"currencyButtonPreferences",value:function(){return this.currencyButtonPreferencesSingleton}},{key:"currencyRatios",value:function(){return this.currencyConversionRatiosSingleton}},{key:"isUpdownIconEnabled",value:function(){return this.showChooser&&!this.whiteArrow||this.showMenuButton&&this.menuShowArrow&&!this.menuWhiteArrow}},{key:"isWhiteUpdownIconEnabled",value:function(){return this.showChooser&&this.whiteArrow||this.showMenuButton&&this.menuShowArrow&&this.menuWhiteArrow}},{key:"areFlagsEnabled",value:function(){return this.amountBoxShowFlag||this.showMenuButton&&this.menuShowFlag}},{key:"hasRates",value:function(){return this.currencies.length>0}},{key:"isMultiCurrencyEnabled",value:function(){return this.enabledPresentmentCurrencies.length>1}}])}(),O=function(){function e(){t(this,e)}return n(e,null,[{key:"getInternationalContext",value:function(t){return P.isNotEmpty(t)?e._removeTrailingSlash(t):""}},{key:"_removeTrailingSlash",value:function(e){return P.replaceLast(e,"/","")}}])}(),L=function(){return n(function e(){t(this,e)},null,[{key:"removeLocalizedContext",value:function(e,t){var r=O.getInternationalContext(t);return P.isNotEmpty(r)?e.replace(r,""):e}}])}(),F=function(){return n(function e(){t(this,e)},null,[{key:"isDemoPage",value:function(e){var t=L.removeLocalizedContext(e,"/");return null!==t.match(/^\/.*\/test.html/)||null!==t.match(/^\/.*\/demo\//)}},{key:"isCollectionPage",value:function(e,t){var r=L.removeLocalizedContext(e,t);return null!==r.match(/^\/collections(\/)?.*/)&&null===r.match(/^\/.*\/products\/.*/)}},{key:"isHomePage",value:function(e,t){var r=L.removeLocalizedContext(e,t);return r.length<=1||null!==r.match(/^\/index/)||null!==r.match(/^\/pages\/home/)}},{key:"isSearchResultsPage",value:function(e,t){var r=L.removeLocalizedContext(e,t);return null!==r.match(/\/search\/?$/)||null!==r.match(/\/search-results-page\/?$/)}},{key:"isProductPage",value:function(e,t){var r=L.removeLocalizedContext(e,t);return null!==r.match(/^\/products\/.*/)||null!==r.match(/^\/.*\/products\/.*/)||null!==r.match(/^\/products_preview.*/)}},{key:"isCartPage",value:function(e,t){return null!==L.removeLocalizedContext(e,t).match(/^\/cart/)}},{key:"isOrderOrCheckoutPage",value:function(e,t){var r=L.removeLocalizedContext(e,t);return null!==r.match(/^\/.*\/thank_you/)||null!==r.match(/^\/.*\/orders\/.*/)||null!==r.match(/^\/.*\/checkouts\/.*/)}}])}(),D=function(){function e(){t(this,e)}return n(e,null,[{key:"isAbsolute",value:function(e){return null!==e.match(/^http.*/)}},{key:"isDemoPage",value:function(){var e=location.pathname;return F.isDemoPage(e)}},{key:"isPreferencesPage",value:function(){var e=location.pathname;return this._isPreferencesPage(e)}},{key:"isHomePage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isHomePage(t,r)}},{key:"isProductPage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isProductPage(t,r)}},{key:"isCartPage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isCartPage(t,r)}},{key:"isCollectionPage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isCollectionPage(t,r)}},{key:"isSearchResultsPage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isSearchResultsPage(t,r)}},{key:"isOrderOrCheckoutPage",value:function(){var t=e._shopifyServletPath(),r=f.getRoute();return F.isOrderOrCheckoutPage(t,r)}},{key:"getInternationalContext",value:function(){return f.getRoute()}},{key:"getCartPage",value:function(){return g.isLocalhost()?location.origin+location.pathname+"/support/test.html":e.getInternationalContext()+"cart"}},{key:"getCheckoutPage",value:function(){return e.getInternationalContext()+"checkout"}},{key:"getProductPage",value:function(t){return e.getInternationalContext()+"products/"+t}},{key:"getHomepageAbsoluteUrl",value:function(){return g.isLocalhost()?location.origin+location.pathname:location.origin+e.getInternationalContext()}},{key:"removeReference",value:function(e){return e.split("#")[0]}},{key:"removeProtocol",value:function(e){var t=e.indexOf("://");return t>0?e.substr(t+1):e}},{key:"_isPreferencesPage",value:function(e){return e.startsWith("/preferences/")}},{key:"_shopifyServletPath",value:function(){return null==window.__st||null==window.__st.pageurl?location.pathname:e._servletPath(window.__st.pageurl)}},{key:"_servletPath",value:function(e){if(P.isEmpty(e))return"";var t=e.indexOf("/");if(-1==t)return"/";var r=e.indexOf("?");return-1==r&&(r=e.length),e.substring(t,r)}}])}(),B=function(){function e(){t(this,e)}return n(e,null,[{key:"addPageClassToBody",value:function(){D.isCartPage()?document.body.classList.add(e.CART_PAGE_CSS_CLASS):D.isProductPage()?document.body.classList.add(e.PRODUCT_PAGE_CSS_CLASS):D.isSearchResultsPage()?document.body.classList.add(e.SEARCH_RESULTS_PAGE_CSS_CLASS):D.isHomePage()?document.body.classList.add(e.HOMEPAGE_CSS_CLASS):D.isCollectionPage()&&document.body.classList.add(e.COLLECTION_PAGE_CSS_CLASS)}}])}();i(B,"PRODUCT_PAGE_CSS_CLASS","cbb-product-page"),i(B,"CART_PAGE_CSS_CLASS","cbb-cart-page"),i(B,"SEARCH_RESULTS_PAGE_CSS_CLASS","cbb-search-results-page"),i(B,"HOMEPAGE_CSS_CLASS","cbb-homepage"),i(B,"COLLECTION_PAGE_CSS_CLASS","cbb-collection-page"),i(B,"addClassToBody",function(e){var t=document.getElementsByTagName("body");if(0==t.length)throw new Error("Body tag not found");t.item(0).classList.add(e)});var M=function(){return n(function e(){t(this,e)},null,[{key:"addStyles",value:function(e){var t=document.createElement("style");t.type="text/css",t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t)}}])}(),U=function(){function e(){t(this,e)}return n(e,null,[{key:"addScripts",value:function(t,r,n){e.addCssScript(r),e._addInlineScript(t,n)}},{key:"addCssScript",value:function(e){P.isNotEmpty(e)&&M.addStyles(e)}},{key:"_addInlineScript",value:function(t,r){P.isNotEmpty(r)&&e._runScript(t,r)}},{key:"_runScript",value:function(e,t){var r=t+"\n//# sourceURL="+e+"-custom-javascript.js";try{new Function(r)()}catch(e){S.log("Error executing Custom Js code: "+e)}}}])}(),W=function(){return n(function e(r){t(this,e),this.chooserCurrencies=r.chooserCurrencies,this.autodetectedCurrencyAvailable=r.autodetectedCurrencyAvailable,this.defaultCurrency=r.defaultCurrency,this.shopCurrency=r.shopCurrency,this.autodetectedCurrency=r.autodetectedCurrency,this.selectedCurrency=r.selectedCurrency},[{key:"resolveCurrency",value:function(){return"linaliva.myshopify.com"===f.getShop()?f.getPresentmentCurrency():this.selectedCurrency?this.selectedCurrency:this.defaultCurrency&&this._chooserContainsCurrency(this.defaultCurrency)?this.defaultCurrency:this.autodetectedCurrencyAvailable||this._chooserContainsCurrency(this.autodetectedCurrency)?this.autodetectedCurrency:this.shopCurrency.code}},{key:"_chooserContainsCurrency",value:function(e){return-1!==this.chooserCurrencies.indexOf(e)}}])}(),G=function(){function e(r){t(this,e),this.chooserCurrencies=r}return n(e,[{key:"withAutodetectedCurrencyAvailable",value:function(e){return this.autodetectedCurrencyAvailable=null==e||e,this}},{key:"withoutAutodetectedCurrencyAvailable",value:function(){return this.autodetectedCurrencyAvailable=!1,this}},{key:"withDefaultCurrency",value:function(e){return this.defaultCurrency=e,this}},{key:"withoutDefaultCurrency",value:function(){return this.defaultCurrency=null,this}},{key:"withShopCurrency",value:function(e){return this.shopCurrency=e,this}},{key:"withAutodetectedCurrency",value:function(e){return this.autodetectedCurrency=e,this}},{key:"withoutSelectedCurrency",value:function(){return this.selectedCurrency=null,this}},{key:"withSelectedCurrency",value:function(e){return this.selectedCurrency=e,this}},{key:"build",value:function(){return new W(this)}}],[{key:"withChooserCurrencies",value:function(t){return new e(t)}}])}(),H=function(){return n(function e(r,n,i,o,a,s){t(this,e),this.currencyRatios=r,this.chooserCurrencies=n,this.autodetectedCurrencyAvailable=i,this.defaultCurrency=o,this.shopCurrency=a,this.autodetectedCurrency=s},[{key:"conversionParameters",value:function(e){var t=G.withChooserCurrencies(this.chooserCurrencies).withAutodetectedCurrencyAvailable(this.autodetectedCurrencyAvailable).withDefaultCurrency(this.defaultCurrency).withShopCurrency(this.shopCurrency).withAutodetectedCurrency(this.autodetectedCurrency).withSelectedCurrency(e).build().resolveCurrency();return this.currencyRatios.getConversionParameters(t)}}])}(),V=function(){function e(){t(this,e)}return n(e,null,[{key:"patternMetadata",value:function(t,r){return{decimalSeparator:e._decimalSeparator(t),symbol:r,symbolFirst:e._symbolFirst(t,r),symbolSpaced:e._symbolSpaced(t,r)}}},{key:"decimalPrecision",value:function(t){var r=t.indexOf(e.DIGIT_SYMBOL)+1,n=t.lastIndexOf(e.DIGIT_SYMBOL);return n\s*\n*/,t).replace(/\s*\n*<\/sup>/,"");return P.safeTrim(r)}},{key:"isAProductPrice",value:function(t){return!e.shouldBeIgnored(t)}},{key:"shouldBeIgnored",value:function(t,r,n){if(r&&t.matches(r))return!!n&&e._elementOrParentsHasClass(t,n,5);var i=e.IGNORE_PRICE_CLASSES+(n?","+n:"");return e._elementOrParentsHasClass(t,i,5)}},{key:"_elementOrParentsHasClass",value:function(t,r,n){return t.matches(r)||e._parentsHasClass(t,r,n)}},{key:"_parentsHasClass",value:function(e,t,r){for(var n=0,i=e.parentNode;i&&1===i.nodeType;){if(i.matches(t))return!0;if(n++,null!=r&&n>r)break;i=i.parentNode}return!1}},{key:"markAsProcessed",value:function(t){t.setAttribute(e.PRICE_PROCESSED_ATTR,e.PRICE_PROCESSED_ATTR_TRUE)}},{key:"markAsUnprocessed",value:function(t){t.setAttribute(e.PRICE_PROCESSED_ATTR,e.PRICE_PROCESSED_ATTR_FALSE)}},{key:"isUnProcessed",value:function(t){return!e.isProcessed(t)}},{key:"isProcessed",value:function(t){return t.getAttribute(e.PRICE_PROCESSED_ATTR)===e.PRICE_PROCESSED_ATTR_TRUE}}])}();i(ee,"PRICE_PROCESSED_ATTR","data-cbb-price-processed"),i(ee,"PRICE_PROCESSED_ATTR_TRUE","true"),i(ee,"PRICE_PROCESSED_ATTR_FALSE","false"),i(ee,"FORBIDDEN_ELEMENTS","html,head,input,textarea,option,sup,script,style,noscript,link,header,footer,meta,title,iframe,head,img,select,path,rect,circle,polygon,ellipse,line,polyline,stop,br,hr,area,base,col,embed,param,source,track,wbr"),i(ee,"DISCOUNT_PRICE_TAG","del,s,strike"),i(ee,"DISCOUNT_PRICE_CLASSES",".cbb-discount-price,.was,.was_price,.old-price,.pmo_strike,.compare-price,.compare-at-price,.compare_at_price,.price-compare-at,.sale-tag,.ls-original-price,.grid-link__sale_price,.product-single__price--compare-at,.product_compare_price,.grid-product__price--original,.product__price--compare,.Price--compareAt,#so-compare-at-label-wrap,.card__price--regular-strike"),i(ee,"IGNORE_PRICE_CLASSES",".cbb-ignored-price,.cbb-frequently-bought-selector-label-name,.cbb-frequently-bought-selector-label-description,.cbb-also-bought-product-name,.cbb-also-bought-product-description,#CartCount,#productDescription,#bk-coupon-box,#top-bar,.spr-review-content-body,.product-single__title,.message,.currency-converter-currency-button,.grid-link__title,.grid-product__title,.ajaxcart__product-name--wrapper,.breadcrumb--truncate,.visually-hidden,.bcpo,.df-card__title,.df-card__description,.s_um_dropdowndiv,.product-aside .product-title,.box.product a.title,.cart-preview .product-title,.cart-item-product .cart-item-title,nav.breadcrumb,.pagination,#judgeme_product_reviews,.jdgm-carousel-wrapper,.faq-main-wrap,.site-nav__link,.product-card__name,.site-nav__dropdown-link,.site-nav__dropdown-container .meganav__link,.cart-img"),i(ee,"SIMPLIFIED_PRICE_CLASSES",".info-bar,.announcement-bar,.announcement-bar--mobile,.announcement,.shopify-policy__container,.bannertop,.promo_banner,.notification-bar,.promo-bar,#fsb_bar,#revy-motivator-bar,#qab_background,.pxs-announcement-bar,.siteAlert,.site-header--text-links,.header-bar__left,.header-bar__message,.__seguno-banner-container,.cart-toggle,.header-cart_preview,#CartDropdown,.top-cart,.header-cart-btn,#cart_block,#shopify-section-hero,.hero__text-content,.afterpay-paragraph,.btn--add-to-cart,.ProductForm__AddToCart,#CartButton,#addToCart-product-template,.prod_label,.save-badge2,.tdf_ribbon,.customer-links,.save_amount_two,#store-return-amp-exchange,.price--compare-at,.grid-product__on-sale,.STP-tiers,#refund-policy,#htusb_container_html_prod_generic_pricing,.so-field-wrap,.so-btn-add-to-cart,.product-description,.product-single__description,#satcb_checkout_btn,.saso-summary,.shipsell-calculator,.testimonial,#productPhoto,.hulkapps-volumes,#bold-modal__content,.selectric-wrapper,.tt-services-block,.quantity-breaks-now-discount-table,.shappify-qty-msg,.shappify_qb_grid,.htusb-ui-cart-text,.cart__product-name,.cart-item--total,.cart-item--sale-price,.cart-item--content-price,#booster-summary-item,.rte,.price-comment,.sro-message,.header__cart-price-bubble,.grid-product__tag--sale"),i(ee,"FORCE_NORMAL_PRICE_CLASSES",".product-description #product-price"),i(ee,"CBB_CLASSES",".currency-converter-wrapper-amount-box,.currency-converter-amount-box,.cbb-currency-flag,.currency-converter-amount,.cbb-price-symbol,.cbb-price-digits,.cbb-price-code,.cbb-currency-updown-icon,.currency-converter-chooser,.currency-converter-chooser-item");var te=function(){return n(function e(r,n){t(this,e);var i=Q.amountFormatFor(r),o="(".concat(r).replace(i.getExpression(),i.getDigitsRegex(n)).replace(/\s/g,e.ESCAPED_SPACE_REGEXP).replace("$",e.ESCAPED_DOLLAR_REGEXP).replace(e.ZERO_WIDTH_SPACES_REGEXP,"").concat(")");this.priceRegex=new RegExp(o)},[{key:"isPrice",value:function(e){return this.priceRegex.lastIndex=0,this.priceRegex.test(e)}},{key:"price",value:function(e){return this._extractPrice(e,2)}},{key:"rawPrice",value:function(e){return this._extractPrice(e,1)}},{key:"_extractPrice",value:function(e,t){this.priceRegex.lastIndex=0;var r=this.priceRegex.exec(e);return null!==r?P.safeTrim(r[t]):null}}])}();i(te,"ESCAPED_SPACE_REGEXP","\\s?"),i(te,"ESCAPED_DOLLAR_REGEXP","\\$"),i(te,"ZERO_WIDTH_SPACES_REGEXP",/[\u200B-\u200D\uFEFF]/g);var re=function(){return n(function e(r,n,i){t(this,e),this.moneyFormat=this._trimMoneyFormat(r),this.moneyFormatWithCurrency=this._trimMoneyFormat(n),this.moneyFormatRegex=new te(this.moneyFormat,i),this.moneyFormatWithCurrencyRegex=new te(this.moneyFormatWithCurrency,i)},[{key:"matchesAnyPriceFormat",value:function(e){return null!==this._moneyFormatForPrice(e)}},{key:"amountFormatForPrice",value:function(e){var t=this._moneyFormatForPrice(e);return Q.amountFormatFor(t)}},{key:"_moneyFormatForPrice",value:function(e){return this._isSafeMoneyFormat(this.moneyFormatWithCurrency,this.moneyFormatWithCurrencyRegex,e)?this.moneyFormatWithCurrency:this._isSafeMoneyFormat(this.moneyFormat,this.moneyFormatRegex,e)?this.moneyFormat:null}},{key:"_isSafeMoneyFormat",value:function(e,t,r){return(!this._isMoneyFormatMissingSymbolAndCode(e)||!this._isLongText(r))&&t.isPrice(r)}},{key:"_isMoneyFormatMissingSymbolAndCode",value:function(e){return P.startsWith(e,"{")&&P.endsWith(e,"}")}},{key:"_isLongText",value:function(e){return e.length>=20}},{key:"_trimMoneyFormat",value:function(e){return e.replace(/\{\{\s?/,"{{").replace(/\s?\}\}/,"}}")}}])}(),ne=function(){return n(function e(){t(this,e)},null,[{key:"rawPrice",value:function(e,t,r){return new te(t.getMoneyFormat(),r).rawPrice(e)}}])}(),ie=function(){function e(r,n,i){t(this,e),this.priceText=r,this.amountFormat=n,this.currency=i}return n(e,[{key:"_normalizeFromPattern",value:function(){var e=this._plainPrice(),t=this._integerPart(e),r=this._decimalPart(e),n=this._fullNormalizedPrice(t,r);return S.debugGroup("Price normalization",[{"Plain: ":e},{"Integer part: ":t},{"Decimal part: ":r},{"Result: ":n}]),n}},{key:"_plainPrice",value:function(){return new te(this.amountFormat.getMoneyFormat(),this.currency).price(this.priceText)}},{key:"_integerPart",value:function(e){var t;null!==this.amountFormat.getDecimalSymbol()?t=e.split(this.amountFormat.getDecimalSymbol())[0]:t=e;return t=(t=(t=(t=t.replace(/\,/g,"")).replace(/\./g,"")).replace(/\s/g,"")).replace(/\'/g,""),t=P.safeTrim(t)}},{key:"_decimalPart",value:function(e){if(null!==this.amountFormat.getDecimalSymbol()){var t,r=e.split(this.amountFormat.getDecimalSymbol());return r.length>1&&(t=r[1],t=P.safeTrim(t)),t}return null}},{key:"_fullNormalizedPrice",value:function(e,t){var r;return r=null!=t?e+"."+t:e,Number(r)}}],[{key:"normalize",value:function(t,r,n){return new e(t,r,n)._normalizeFromPattern()}}])}(),oe=function(){function e(){t(this,e)}return n(e,null,[{key:"convertedPrice",value:function(t,r,n,i){var o=e._convertPrice(t,r);return e._round(o,r,n,i)}},{key:"_convertPrice",value:function(e,t){return e*t}},{key:"_round",value:function(t,r,n,i){if(e._roundingApplicable(t,r,i)){var o=Math.round(t);return i.roundTo99&&(o=e._roundTo99(o,n)),o}return t}},{key:"_roundingApplicable",value:function(e,t,r){return!(e<1)&&((!(1===t)||!r.roundOnlyConverted)&&r.rounding)}},{key:"_roundTo99",value:function(t,r){return t-e._roundAmount(r)}},{key:"_roundAmount",value:function(e){if(0===e)return 0;for(var t=1,r=0;rt?Math.min(e.DECIMAL_PRECISION,r):t}},{key:"_extractRequiredPrecision",value:function(t){if(this._integerPart()>0)return t;var r=String(this.price).split(e.DECIMAL_SEPARATOR);if(r.length>1){var n=r[1],i=this._countLeadingZeros(n);return i>=t?i+1:t}return t}},{key:"_countLeadingZeros",value:function(e){for(var t=0;"0"===e.charAt(t)&&t0&&e<1||t.hasDecimals()&&r>0}},{key:"_formatIntegerPart",value:function(e,t){return e.replace(/\B(?=(\d{3})+(?!\d))/g,t)}}])}(),le=function(){function e(){t(this,e)}return n(e,null,[{key:"priceTextMetadata",value:function(t,r){return{leadingText:e._findLeadingText(t,r),trailingText:e._findTrailingText(t,r)}}},{key:"_findLeadingText",value:function(e,t){return 0!==e.indexOf(t)?e.substr(0,e.indexOf(t)):null}},{key:"_findTrailingText",value:function(e,t){var r=e.indexOf(t)+t.length;return r'}},{key:"upDownIconElement",value:function(t){var r=document.createElement("img");return r.classList.add(e.UPDOWN_ICON_CLASS),r.src=t?e.UPDOWN_ICON_WHITE:e.UPDOWN_ICON,r.width=e.UPDOWN_ICON_WIDTH,r.height=e.UPDOWN_ICON_WIDTH,r.style.verticalAlign="middle",r.style.display="inline",r.style.maxWidth=e.UPDOWN_ICON_MAX_WIDTH_PX,r.style.margin="0 0 3px 0",r.style.maxHeight=e.UPDOWN_ICON_MAX_WIDTH_PX,r.style.opacity="1",r.alt="",r}},{key:"flagHtml",value:function(t,r){return t?e._flagFromIndividualImage(t,r):""}},{key:"flagElement",value:function(t,r){return t?e._flagElementFromIndividualImage(t,r):document.createElement("img")}},{key:"updateFlag",value:function(t,r,n){t.src=e.INDIVIDUAL_FLAG_BASE_URL+"/"+r+".png",t.alt=r,t.style.width=n+"px",t.style.height=n+"px",t.style.maxWidth=n+"px",t.style.maxHeight=n+"px",t.style.minWidth=n+"px",t.style.minHeight=n+"px"}},{key:"_flagFromIndividualImage",value:function(t,r){var n=e.INDIVIDUAL_FLAG_BASE_URL+"/"+t+".png",i="width:"+r+"px;height:"+r+"px;max-width:"+r+"px;max-height:"+r+"px;min-width:"+r+"px;min-height:"+r+"px;display:inline-block; padding:0; margin:0 2px 0 0; border:0; background-color: transparent; vertical-align:middle; opacity:1";return''+t+''}},{key:"_flagElementFromIndividualImage",value:function(t,r){var n=document.createElement("img");return n.classList.add(e.FLAG_CLASS),n.src=e.INDIVIDUAL_FLAG_BASE_URL+"/"+t+".png",n.style.width=r+"px",n.style.height=r+"px",n.style.maxWidth=r+"px",n.style.maxHeight=r+"px",n.style.minWidth=r+"px",n.style.minHeight=r+"px",n.style.display="inline-block",n.style.padding="0",n.style.margin="0 2px 0 0",n.style.border="0",n.style.backgroundColor="transparent",n.style.verticalAlign="middle",n.style.opacity="1",n.loading="lazy",n.alt=t,n}}])}();ue=de,i(de,"IMAGES_BASE_URL",g.cdnUrl()+"/images"),i(de,"INDIVIDUAL_FLAG_BASE_URL",ue.IMAGES_BASE_URL+"/currency-converter-plus/flags"),i(de,"FLAG_CLASS","cbb-currency-flag"),i(de,"UPDOWN_ICON",ue.IMAGES_BASE_URL+"/updown.gif"),i(de,"UPDOWN_ICON_WHITE",ue.IMAGES_BASE_URL+"/updown-white.gif"),i(de,"UPDOWN_ICON_CLASS","cbb-currency-updown-icon"),i(de,"UPDOWN_ICON_WIDTH","11"),i(de,"UPDOWN_ICON_MAX_WIDTH_PX",ue.UPDOWN_ICON_WIDTH+"px");var fe=function(){function e(){t(this,e)}return n(e,null,[{key:"isAutodetectedCurrency",value:function(t){return t.name===e.AUTODETECT_CURRENCY_NAME}},{key:"isClearCurrency",value:function(t){return t.name===e.CLEAR_CURRENCY_NAME}},{key:"getCurrencyName",value:function(t,r){return r?e._shortCurrencyName(t):e._regularCurrencyName(t)}},{key:"_shortCurrencyName",value:function(t){return e.isAutodetectedCurrency(t)?e.AUTODETECT_CURRENCY_SHORT_NAME:e.isClearCurrency(t)?e.CLEAR_CURRENCY_SHORT_NAME:t.code}},{key:"_regularCurrencyName",value:function(t){return e.isAutodetectedCurrency(t)||e.isClearCurrency(t)?t.name:t.name+" ("+t.code+")"}}])}();i(fe,"AUTODETECT_CURRENCY_NAME","Autodetect currency"),i(fe,"CLEAR_CURRENCY_NAME","Clear selection"),i(fe,"AUTODETECT_CURRENCY_SHORT_NAME","Auto"),i(fe,"CLEAR_CURRENCY_SHORT_NAME","Clear");var ye=function(){function e(){t(this,e)}return n(e,null,[{key:"apply",value:function(t,r){try{e._applySafe(t,r)}catch(i){var n=e._elementRef(t);S.log("Syntax error: could not apply to the element "+n+" the additional styles: "+r)}}},{key:"_applySafe",value:function(e,t){if(!P.isEmpty(t)&&(t=P.removeWhiteSpaces(t),!P.isEmpty(t))){var r=JSON.parse(t);for(var n in r)e.style[n]=r[n]}}},{key:"_elementRef",value:function(e){var t=e.id;return P.isNotEmpty(t)?"with id "+t:(t=e.className,P.isNotEmpty(t)?"with class "+t:e.tagName)}}])}(),me=function(){function e(){t(this,e)}return n(e,null,[{key:"createFixedDiv",value:function(e,t){var r=document.createElement("div");return r.style.backgroundImage="url("+e+")",r.style.backgroundRepeat="repeat-x",r.style.backgroundColor="transparent",r.style.position="fixed",r.style.zIndex="100020",t&&(r.className=t),document.body.insertBefore(r,document.body.firstChild),r}},{key:"isTextNode",value:function(t){return t.nodeType==e.TEXT_NODE}},{key:"scrollTop",value:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}}])}();i(me,"TEXT_NODE",3);var pe=function(){function e(r,n,i){t(this,e),this.mainColour=r.mainColour,this.bgColour=r.bgColour,this.borderColour=r.borderColour,this.chooserAdditionalStyles=r.chooserAdditionalStyles,this.chooserFlagSize=r.chooserFlagSize,this.chooserItemAdditionalStyles=r.chooserItemAdditionalStyles,this.thereAreManyCurrencies=r.thereAreManyCurrencies(),this.shortOptionName=n,this.bodySize=i,this.fixed=!1,this.fixedAtBottom=!1,this.fixedAtRight=!1,this._createChooser()}return n(e,[{key:"render",value:function(){document.body.append(this.list)}},{key:"toggle",value:function(e){var t=this;this.fixed?this._setChooserFixedPosition(e):this._setChooserAbsolutePosition(e),this.list.style.display="",setTimeout(function(){return t.list.style.opacity=t._isShowing()?"0":"1"},1)}},{key:"hide",value:function(){this.list.style.opacity="0"}},{key:"highlightCurrency",value:function(t){this.list.querySelectorAll("li").forEach(function(e){return e.style.fontWeight="normal"});var r=this.list.querySelector("li."+e.CHOOSER_ITEM_FLAG_CLASS_PREFIX+t);r&&(r.style.fontWeight="bold")}},{key:"addOption",value:function(e,t,r){var n=this._currencyOption(e,t);this._configureOptionEvents(n,e,r),this._addPreviousOptionSeparator(),this.list.append(n)}},{key:"addMenuButtonConfiguration",value:function(e){this.fixed=e.isFixed(),this.fixedAtBottom=e.isFixedAtBottom(),this.fixedAtRight=e.isFixedAtRight(),this._updateChooser()}},{key:"_createChooser",value:function(){var t=this;this.list=document.createElement("ul"),this.list.classList.add(e.CHOOSER_CLASS),this.list.classList.add(he.GOOGLE_SKIP_TRANSLATE_INHIBIT_CLASS),this.list.classList.add(he.GOOGLE_NO_TRANSLATE_INHIBIT_CLASS),this.list.style.listStyleType="none",this.list.style.textAlign="left",this.list.style.border="solid 1px "+this.borderColour,this.list.style.backgroundColor=this.bgColour,this.list.style.borderRadius="2px",this.list.style.position=this.fixed?"fixed":"absolute",this.list.style.zIndex="100000000",this.list.style.margin="0",this.list.style.padding="2px",this.bodySize.height()>800&&(this.list.style.maxHeight="400px"),this.list.style.minWidth=this.shortOptionName&&!this.thereAreManyCurrencies?"70px":"90px",this.list.style.minHeight="50px",this.list.style.overflowY="auto",this.list.style.opacity="0",this.list.style.display="none",this.list.style.transition="opacity 0.3s",this.list.addEventListener("transitionend",function(){t.list.style.display=t._isShowing()?"":"none"}),ye.apply(this.list,this.chooserAdditionalStyles),this.hide()}},{key:"_isShowing",value:function(){return"1"==this.list.style.opacity}},{key:"_updateChooser",value:function(){this.list.style.position=this.fixed?"fixed":"absolute"}},{key:"_addPreviousOptionSeparator",value:function(){var e=this.list.children,t=e[e.length-1];t&&(t.style.borderBottom="solid 1px "+this.borderColour)}},{key:"_currencyOption",value:function(e,t){var r=this._buildOption(t);return this._addOptionFlag(r,t),this._addOptionText(r,e),r}},{key:"_buildOption",value:function(t){var r=document.createElement("li");return r.classList.add(e.CHOOSER_ITEM_CLASS),r.classList.add(e.CHOOSER_ITEM_FLAG_CLASS_PREFIX+t),r.style.listStyleType="none",r.style.display="list-item",r.style.cursor="pointer",r.style.color=this.mainColour,r.style.backgroundColor=this.bgColour,r.style.margin="0",r.style.padding="1px",r.style.whiteSpace="nowrap",r.style.overflowX="hidden",r.style.maxWidth="220px",ye.apply(r,this.chooserItemAdditionalStyles),r}},{key:"_addOptionFlag",value:function(e,t){var r=de.flagElement(t,this.chooserFlagSize);e.append(r)}},{key:"_addOptionText",value:function(e,t){var r=document.createElement("span");r.style.verticalAlign="middle",r.style.marginLeft="2px",r.textContent=fe.getCurrencyName(t,this.shortOptionName),e.append(r)}},{key:"_configureOptionEvents",value:function(e,t,r){var n=this;e.addEventListener("mouseover",function(){e.style.color=n.bgColour,e.style.backgroundColor=n.mainColour}),e.addEventListener("mouseout",function(){e.style.color=n.mainColour,e.style.backgroundColor=n.bgColour}),e.addEventListener("click",function(){var n=new CustomEvent("currencyChanged",{detail:t.code});e.dispatchEvent(n),r(t.code)})}},{key:"_setChooserFixedPosition",value:function(e){var t=$.margin(e),r=$.offset(e);if(this.fixedAtRight){var n=r.right+t.right;this.list.style.right=n+"px"}else{var i=r.left+t.left;this.list.style.left=i+"px"}if(this.fixedAtBottom){var o=r.bottom+e.offsetHeight+t.bottom+2;this.list.style.bottom=o+"px"}else{var a=r.top+e.offsetHeight+t.top+2;this.list.style.top=a+"px"}}},{key:"_setChooserAbsolutePosition",value:function(e){var t=e.getBoundingClientRect(),r=e.offsetHeight,n=$.margin(e),i=t.top+me.scrollTop()+r+n.bottom;this.list.style.top=i+"px",this.list.style.left=t.left+document.body.scrollLeft+"px"}}])}();i(pe,"CHOOSER_CLASS","currency-converter-chooser"),i(pe,"CHOOSER_ITEM_CLASS","currency-converter-chooser-item"),i(pe,"CHOOSER_ITEM_FLAG_CLASS_PREFIX","cbb-currency-code-");var ve=function(){return n(function e(r,n,i){t(this,e),this.chooserCurrencies=r,this.currencyConversionRatios=n,this.orderByCurrencyCode=i},[{key:"getProperChooserCurrencies",value:function(){var e=this._extractChooserCurrencies();return this._sortChooserCurrencies(e,this.orderByCurrencyCode)}},{key:"_extractChooserCurrencies",value:function(){var e=this,t=[];return this.chooserCurrencies.forEach(function(r){var n=e.currencyConversionRatios.getCurrency(r);n&&t.push(n)},this),t}},{key:"_sortChooserCurrencies",value:function(e,t){var r=this;return t?e.sort(function(e,t){return r._sortByCurrencyCode(e,t)}):e.sort(function(e,t){return r._sortByCurrencyName(e,t)}),e}},{key:"_sortByCurrencyCode",value:function(e,t){return this._sort(e,t,!0)}},{key:"_sortByCurrencyName",value:function(e,t){return this._sort(e,t,!1)}},{key:"_sort",value:function(e,t,r){var n,i;return r?(n=e.code.toLowerCase(),i=t.code.toLowerCase()):(n=e.name.toLowerCase(),i=t.name.toLowerCase()),ni?1:0}}])}(),_e=function(){function e(){t(this,e)}return n(e,null,[{key:"getHiddenProperty",value:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t1?r-1:0),i=1;i"+(r=r||"")+""}},{key:"_buildPriceContainer",value:function(){this.price.isDiscountPrice()?this.priceElement=document.createElement("s"):(this.priceElement=document.createElement("span"),this.priceElement.style.textDecoration="inherit"),this._updatePriceClass(),this.priceElement.style.display="inline-block",this.priceElement.style.marginRight=this.price.isNotSimplifiedPrice()?e.MARGIN_IN_BETWEEN:"0",this.priceElement.style.marginRight=this.price.isNotSimplifiedPrice()?e.MARGIN_IN_BETWEEN:"0",this.priceElement.style.fontFamily=this.price.getFontFamily(),this.priceElement.style.fontSize=this.price.getFontSize(),this.priceElement.style.fontWeight=this.price.getFontWeight(),this.priceElement.style.color="inherit",this.priceElement.style.float="none"}},{key:"_updatePriceClass",value:function(){this.priceElement.setAttribute("class",e.PRICE_CLASS),this.priceElement.classList.add(e.PRICE_CURRENCY_PREFIX+this.code)}},{key:"_buildPriceSymbolElement",value:function(){this.priceSymbolElement=document.createElement("span"),this.priceSymbolElement.classList.add(e.PRICE_SYMBOL_CLASS),this.priceSymbolElement.style.padding="0px 1px",this.priceSymbolElement.style.color="inherit",this.priceSymbolElement.style.float="none",this.priceSymbolElement.textContent=this.symbol;var t=this.patternMetadata.symbolSpaced?e.MARGIN_IN_BETWEEN:e.NO_MARGIN_IN_BETWEEN;this.patternMetadata.symbolFirst?this.priceSymbolElement.style.marginRight=t:this.priceSymbolElement.style.marginLeft=t,this.patternMetadata.symbolFirst?this.priceElement.prepend(this.priceSymbolElement):this.priceElement.append(this.priceSymbolElement)}},{key:"_buildPriceCodeElement",value:function(){this.priceCodeElement=document.createElement("span"),this.priceCodeElement.classList.add(e.PRICE_CODE_CLASS),this.priceCodeElement.style.marginLeft=e.MARGIN_IN_BETWEEN,this.priceCodeElement.style.padding="0px 1px",this.priceCodeElement.style.color="inherit",this.priceCodeElement.style.float="none",this.priceCodeElement.textContent=this.code,this.priceElement.append(this.priceCodeElement)}}])}();i(Te,"PRICE_CLASS","currency-converter-amount"),i(Te,"PRICE_CURRENCY_PREFIX","cbb-price-currency-"),i(Te,"PRICE_DIGITS_CLASS","cbb-price-digits"),i(Te,"PRICE_SYMBOL_CLASS","cbb-price-symbol"),i(Te,"PRICE_CODE_CLASS","cbb-price-code"),i(Te,"MARGIN_IN_BETWEEN","3px"),i(Te,"NO_MARGIN_IN_BETWEEN","0");var Ae=function(){function e(r,n,i){t(this,e),this.price=r,this.preferences=n,this.replacePrices=i,this.notSimplifiedPrice=this.price.isNotSimplifiedPrice(),this.box=be.buildWrapper(this.price,this.preferences),this._build()}return n(e,[{key:"_build",value:function(){this._buildAmountBox(),this._addLeadingText(),this._addFlag(),this._addPrice(),this._addChooser(),this._addTrailingText(),this._showOrHide()}},{key:"_buildAmountBox",value:function(){var t=this.price.isNotDiscountPrice();this.internalBox=document.createElement("span"),this.internalBox.classList.add(e.AMOUNT_BOX_CLASS),this.internalBox.style.display="inline-block",this.internalBox.style.whiteSpace="nowrap",this.internalBox.style.padding=this.notSimplifiedPrice?"2px":"0",this.internalBox.style.lineHeight="initial",this.internalBox.style.color=this.preferences.mainColour?this.preferences.mainColour:this.price.getFontColor(),this.internalBox.style.fontSize=this.price.getFontSize(),this.internalBox.style.fontStyle=this.price.getFontStyle(),this.internalBox.style.fontWeight=this.price.getFontWeight(),this.internalBox.style.textDecoration=this.price.getTextDecoration(),this.internalBox.style.backgroundColor=this.preferences.bgColour,this.preferences.replacePrices&&!this.preferences.showChooser&&(this.internalBox.style.padding="0"),t&&this.notSimplifiedPrice&&this.preferences.showBorder&&this.preferences.showChooser&&(this.internalBox.style.border="solid 1px "+this.preferences.borderColour,this.internalBox.style.borderRadius="2px"),t&&this.notSimplifiedPrice&&this.preferences.showChooser&&this._addHoverStyles(this.internalBox),ye.apply(this.internalBox,this.preferences.amountBoxAdditionalStyles),this.box.append(this.internalBox)}},{key:"_addHoverStyles",value:function(e){e.style.cursor="pointer",e.addEventListener("mouseover",function(){e.style.opacity="0.8"}),e.addEventListener("mouseout",function(){e.style.opacity="1"})}},{key:"_addLeadingText",value:function(){var e=this.price.boilerplateTextMetadata.leadingText;if(null!=e&&this.replacePrices){var t=document.createElement("span");t.style.whiteSpace="normal",t.style.color=this.preferences.mainColour?this.preferences.mainColour:this.price.getFontColor(),t.style.fontSize=this.price.getFontSize(),t.style.fontStyle=this.price.getFontStyle(),t.style.fontWeight=this.price.getFontWeight(),t.style.textDecoration=this.price.getTextDecoration(),t.innerHTML=e,this.box.prepend(t)}}},{key:"_addTrailingText",value:function(){var e=this.price.boilerplateTextMetadata.trailingText;if(null!=e&&this.replacePrices){var t=document.createElement("span");t.style.whiteSpace="normal",t.style.color=this.preferences.mainColour?this.preferences.mainColour:this.price.getFontColor(),t.style.fontSize=this.price.getFontSize(),t.style.fontStyle=this.price.getFontStyle(),t.style.fontWeight=this.price.getFontWeight(),t.style.textDecoration=this.price.getTextDecoration(),t.innerHTML=e,this.internalBox.after(t)}}},{key:"_addFlag",value:function(){this.flag=de.flagElement(this.price.code,this.preferences.amountBoxFlagSize),this.internalBox.prepend(this.flag)}},{key:"_addPrice",value:function(){this.amountBoxPrice=new Te(this.price,this.preferences.showCode),this.priceElement=this.amountBoxPrice.getPrice(),this.internalBox.append(this.priceElement)}},{key:"_addChooser",value:function(){this.notSimplifiedPrice&&this._showChooser()&&(this.chooser=de.upDownIconElement(this.preferences.whiteArrow),this.internalBox.append(this.chooser))}},{key:"_showChooser",value:function(){return this.preferences.showChooser&&this.notSimplifiedPrice&&this.price.isNotDiscountPrice()&&this.price.isNotLabelElement()}},{key:"_showOrHide",value:function(){this.price.isAmountBoxEmpty()||this.price.isDiscountPrice()&&0==this.price.getPrice()?this._hide():this._show()}},{key:"update",value:function(){this._updateFlag(),this._updatePrice(),this._updatePriceStyles(),this._showOrHide()}},{key:"_updateFlag",value:function(){de.updateFlag(this.flag,this.price.code,this.preferences.amountBoxFlagSize)}},{key:"_updatePrice",value:function(){this.amountBoxPrice.updateWithVariant()}},{key:"_updatePriceStyles",value:function(){this.internalBox.style.color=this.preferences.mainColour?this.preferences.mainColour:this.price.getFontColor(),this.internalBox.style.fontSize=this.price.getFontSize()}},{key:"_hide",value:function(){this.amountBoxPrice.hide(),this.flag.style.display="none"}},{key:"_show",value:function(){this.amountBoxPrice.show(),this.notSimplifiedPrice&&this.preferences.showFlag?this.flag.style.display="inline-block":this.flag.style.display="none"}},{key:"remove",value:function(){this.box.remove()}},{key:"boxElement",value:function(){return this.box}},{key:"internalBoxElement",value:function(){return this.internalBox}},{key:"hasFlag",value:function(){return"none"!=this.flag.style.display}},{key:"hasChooser",value:function(){return null!=this.chooser}},{key:"hasPrice",value:function(){return"none"!=this.priceElement.style.display}}])}();i(Ae,"AMOUNT_BOX_CLASS","currency-converter-amount-box");var we=function(){return n(function e(r,n){t(this,e),this.preferences=r,this.currencyChooser=n},[{key:"replacePrices",value:function(e){ke.processTablePrices(e);for(var t=[],r=[],n=0;n0?r[0]:null}},{key:"isEmpty",value:function(e){if(p.isNull(e))return!0;if(Array.isArray(e))return 0===e.length;throw new Error("Illegal argument exception: expected Array but was "+typeof e)}},{key:"isNotEmpty",value:function(t){return!e.isEmpty(t)}},{key:"distinct",value:function(e){return e.filter(function(e,t,r){return r.indexOf(e)===t})}},{key:"arrayEquals",value:function(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every(function(e,r){return e==t[r]})}},{key:"removeDuplicates",value:function(e){return e.filter(function(t,r){return e.indexOf(t)===r})}},{key:"cleanEmptyElements",value:function(e){return e.filter(function(e){return null!=e})}},{key:"doesNotContainValue",value:function(t,r){return!e.containsValue(t,r)}},{key:"containsValue",value:function(e,t){for(var r=0;r0}},{key:"_isValidNewElement",value:function(e){return ee.isValidElement(e)&&ee.isUnProcessed(e)}},{key:"_hasAllowedCssClass",value:function(e){var t=this.priceConfiguration.customTextNodePriceSelectors,r=this.priceConfiguration.customIgnoredPriceSelectors;return!ee.shouldBeIgnored(e,t,r)}},{key:"_isPrice",value:function(e){if(ee.containsSuperScriptPrice(e)){var t=this._buildSuperScriptPrice(e);return this.priceFormatResolver.matchesAnyPriceFormat(t.getRawPrice())}return this.priceFormatResolver.matchesAnyPriceFormat(e.textContent)}},{key:"_buildSuperScriptPrice",value:function(e){var t=this._findSupPrice(e);return new Oe(t,this.priceConfiguration)}},{key:"_findSupPrice",value:function(e){var t=e.cloneNode(!0);return Array.from(t.children).forEach(function(e){e.matches("sup")||e.remove()}),t}}])}();i(De,"DEFAULT_PRICE_SELECTORS",["#productPrice.h1",".price",".money",".total",".grid-link__meta",".product-price",".product_price",".product-single__price",".product-item__price",".product-item--price > span.h1",".current_price",".grid-product__price",".actual-price",".prod-price",".product__price",".pp_price",".product-card__price",".product-grid h4",".thumbnail-price > a",".price_total",".h1.medium--left","#formatted_option_total",".cart-item__subtotal",".cart-subtotal--price",".cart-subtotal__price",".cart_subtotal",".cart__subtotal",".cart-subtotal",".cart__total",".cart_price",".ajaxcart__price",".ajaxcart__subtotal","#ajaxifyCart span.h2",".subtotal_amount",".collection__product-price",".sca-qv-product-price",'span[itemprop="price"]',".coll-prod-price.on-sale.accent-text",".grid-product__on-sale > p",".product-item__price-wrapper",".product-grid-item > p",".product-block--price",".price-regular > span",".special-price",".cbb-currency"]);var Be=function(){return n(function e(r){t(this,e),this.regularPriceLocator=new Ie(r),this.superScriptPriceLocator=new Le(r),this.textNodePriceLocator=new De(r),this.customIgnoredPriceSelectors=r.customIgnoredPriceSelectors},[{key:"priceElements",value:function(){var e=this.regularPriceLocator.priceElements(),t=this.superScriptPriceLocator.priceElements();return e.concat(t)}},{key:"textNodePriceElements",value:function(){return this.textNodePriceLocator.priceElements()}}])}(),Me=function(){return n(function e(){t(this,e)},null,[{key:"converted",value:function(e,t){return{preferences:e,currencyCode:t}}},{key:"currencyChange",value:function(e,t){return{preferences:e,currencyCode:t}}},{key:"menuButtonRendered",value:function(e){return{preferences:e}}}])}(),Ue=function(){function e(){t(this,e)}return n(e,null,[{key:"triggerConvertedEvent",value:function(t){Ee.trigger(e.CONVERTED,t)}},{key:"triggerCurrencyChangeEvent",value:function(t){Ee.trigger(e.CURRENCY_CHANGE,t)}},{key:"triggerMenuButtonRenderedEvent",value:function(t){Ee.trigger(e.MENU_BUTTON_RENDERED,t)}}])}();i(Ue,"CONVERTED","codeblackbelt:currency-converter-plus:converted"),i(Ue,"CURRENCY_CHANGE","codeblackbelt:currency-converter-plus:currency-change"),i(Ue,"MENU_BUTTON_RENDERED","codeblackbelt:currency-converter-plus:menu-button-rendered");var We=function(){function e(r,n){t(this,e),this.priceFormatResolver=new re(n.priceFormat,n.priceFormatWithCurrency,n.code)}return n(e,[{key:"wrapRegularTextNodePrice",value:function(e){var t=this;Array.from(e.childNodes).filter(function(e){return t._isTextNodePrice(e)}).forEach(function(r){return e.replaceChild(t._wrapper(r),r)})}},{key:"_isTextNodePrice",value:function(e){var t=e.textContent;return t=P.safeTrim(t),me.isTextNode(e)&&this.priceFormatResolver.matchesAnyPriceFormat(t)}},{key:"_wrapper",value:function(t){var r=document.createElement("span");return r.classList.add(e.SPECIAL_PRICE_CLASS),r.textContent=t.textContent,r}}])}();i(We,"SPECIAL_PRICE_CLASS","cbb-special-price");var Ge=function(){function e(){t(this,e)}return n(e,[{key:"wrapSuperScriptTextNodePrice",value:function(e){var t=this._nonSuperScriptContent(e),r=this._extractSuperScriptPrice(e),n=this._wrap(r);this._removeAllChildNodes(e),this._addWrappedSuperScriptPrice(e,n),this._addRemainingPriceContent(e,t)}},{key:"_nonSuperScriptContent",value:function(e){return Array.from(e.children).filter(function(e){return!e.matches("sup")})}},{key:"_extractSuperScriptPrice",value:function(e){var t=e.cloneNode(!0);return this._nonSuperScriptContent(t).forEach(function(e){return e.remove()}),t.innerHTML}},{key:"_wrap",value:function(t){var r=document.createElement("span");return r.classList.add(e.SPECIAL_PRICE_CLASS),r.innerHTML=t,r}},{key:"_removeAllChildNodes",value:function(e){e.replaceChildren()}},{key:"_addWrappedSuperScriptPrice",value:function(e,t){e.append(t)}},{key:"_addRemainingPriceContent",value:function(e,t){t.forEach(function(t){return e.append(t)})}}])}();i(Ge,"SPECIAL_PRICE_CLASS","cbb-special-price");var He=function(){return n(function e(r,n){t(this,e),this.priceElements=r,this.regularTextNodePriceWrapper=new We(r,n),this.superScriptTextNodePricesWrapper=new Ge},[{key:"processTextNodePrices",value:function(){this._wrapTextNodes()}},{key:"_wrapTextNodes",value:function(){var e=this;this.priceElements.forEach(function(t){ee.containsSuperScriptPrice(t)?e._wrapSuperScriptTextNodePrice(t):e._wrapRegularTextNodePrice(t)})}},{key:"_wrapRegularTextNodePrice",value:function(e){this.regularTextNodePriceWrapper.wrapRegularTextNodePrice(e)}},{key:"_wrapSuperScriptTextNodePrice",value:function(e){this.superScriptTextNodePricesWrapper.wrapSuperScriptTextNodePrice(e)}}])}(),Ve=function(){return n(function e(r,n,i){t(this,e),this.preferences=r,this.amountBoxAppender=n,this.priceReplacer=i,this.priceConfiguration=new Ne(r),this.priceLocator=new Be(this.priceConfiguration),this.prices=[]},[{key:"render",value:function(){this._renderTextNodePrices(),this._renderRemovedPrices(),this._renderUpdatedPrices(),this._renderNewPrices()}},{key:"processPrices",value:function(e){S.debug("Processing prices with the following conversion parameters"),S.debug(e),this.priceConfiguration.updateConversionParameters(e),S.debug(this.priceConfiguration),this.textNodePrices=this._findTextNodePrices(),this.removedPrices=this._findRemovedPrices(),this.updatedPrices=this._findUpdatedPrices(),this.newPrices=this._findNewPrices();var t=Me.converted(this.preferences,e.code);Ue.triggerConvertedEvent(t)}},{key:"updatePrices",value:function(e){S.debug("Updating prices with the following conversion parameters"),S.debug(e),this.priceConfiguration.updateConversionParameters(e),S.debug(this.priceConfiguration),this._updatePrices(this.prices);var t=Me.converted(this.preferences,e.code);Ue.triggerConvertedEvent(t)}},{key:"_findTextNodePrices",value:function(){return this.priceLocator.textNodePriceElements()}},{key:"_findRemovedPrices",value:function(){for(var e=[],t=0;t0?n[0]:r[0]}},{key:"findTargetElements",value:function(t){if(!t)return null;var r=e._safeQuerySelectorAll(t);if(0==r.length)return null;var n=Array.from(r).filter(function(e){return Ke.isVisible(e)});return n.length>0?n:null}},{key:"_safeQuerySelectorAll",value:function(e){try{return document.querySelectorAll(e)}catch(e){return[]}}}])}(),Qe=function(){return n(function e(){t(this,e)},null,[{key:"append",value:function(e,t,r){"BEFORE"===r?t.before(e):"FIRST_CHILD"===r?t.prepend(e):"LAST_CHILD"===r?t.append(e):t.after(e)}},{key:"isAppended",value:function(e,t,r){return"FIRST_CHILD"===r||"LAST_CHILD"===r?Ke.anyChildrenMatches(t,e):Ke.anySiblingMatches(t,e)}}])}(),$e=function(){function e(r,n,i){t(this,e),this.element=r,this.cartPreferences=n,this.priceConfiguration=i,this.prices=[],this.cartNote=null,this.cartNoteFormatter=new ze(n.textFormatPreferences()),this.targetChooser=new qe(this.cartPreferences),this.target=Je.findTargetElement(this.targetChooser.targetSelector()),this.target=this.target?this.target:this.element}return n(e,[{key:"addCartNote",value:function(e){this._isTargetMarkedAsCompleted()&&this._isNoteAlreadyPlaced()||(this.cartNote=this._buildCartNote(e),this.cartNote.isEmpty()||(this._hasManualSelector()?this._addManualCartNote():this._addCartNote(),this._markTargetAsCompleted()))}},{key:"removeCartNote",value:function(){null!=this.cartNote&&(this.cartNote.remove(),this.cartNote=null,this._unmarkTargetAsCompleted())}},{key:"equals",value:function(e){return e.element===this.element}},{key:"addTrackingAttributes",value:function(e,t,r){this.cartPreferences.addTrackingAttributes&&Ye.addTrackingAttributes(this.element,e,t,r)}},{key:"removeTrackingAttributes",value:function(){Ye.removeTrackingAttributes(this.element)}},{key:"_buildCartNote",value:function(e){var t=this.cartNoteFormatter.formattedText(e),r=this.cartPreferences.additionalStyles;return new je(t,r)}},{key:"_isNoteAlreadyPlaced",value:function(){return this._hasManualSelector()?Qe.isAppended(e.CART_NOTE_SELECTOR,this.target,this.targetChooser.targetPlacement()):Ke.anySiblingMatches(this.target,e.CART_NOTE_SELECTOR)}},{key:"_hasManualSelector",value:function(){return null!=Je.findTargetElement(this.targetChooser.targetSelector())}},{key:"_addManualCartNote",value:function(){var e=this.cartNote.getNote();Qe.append(e,this.target,this.targetChooser.targetPlacement())}},{key:"_addCartNote",value:function(){var e=this.cartNote.getNote();this.element.after(e)}},{key:"_isTargetMarkedAsCompleted",value:function(){return!(!this.target.getAttribute(e.CART_NOTE_ADDED_ATTRIBUTE)||"true"!==this.target.getAttribute(e.CART_NOTE_ADDED_ATTRIBUTE))}},{key:"_markTargetAsCompleted",value:function(){this.target.setAttribute(e.CART_NOTE_ADDED_ATTRIBUTE,"true")}},{key:"_unmarkTargetAsCompleted",value:function(){this.target.setAttribute(e.CART_NOTE_ADDED_ATTRIBUTE,null)}}])}();i($e,"CART_NOTE_ADDED_ATTRIBUTE","data-currency-note-added"),i($e,"CART_NOTE_SELECTOR",".currency-converter-cart-note");var Ze=function(){function e(){t(this,e)}return n(e,[{key:"carts",value:function(t,r,n){var i=this,o=document.body.querySelectorAll(e.CART_FORM_SELECTOR),a=Array.from(o).filter(function(e){return(!!n||Ke.isVisible(e))&&i._isNotAjaxifyForm(e)&&i._isNotAddToCartForm(e)});return this._formElements(a,t,r)}},{key:"_isNotAjaxifyForm",value:function(t){return!t.classList.contains(e.AJAXIFY_CART_CLASS)}},{key:"_isNotAddToCartForm",value:function(e){var t=e.getAttribute("action");return!P.contains(t,"/cart/add")}},{key:"_formElements",value:function(e,t,r){var n=[];return e.forEach(function(e){var i=new $e(e,t,r);n.push(i)}),n}}])}();i(Ze,"CART_FORM_SELECTOR",'form[action*="/cart"], form[action="/a/checkout"],form.cart-form'),i(Ze,"AJAXIFY_CART_CLASS","ajaxcart");var et=function(r){function i(r,n,o){return t(this,i),e(this,i,[r,n,o])}return a(i,r),n(i,[{key:"_addCartNote",value:function(){var e=this.element.querySelector(i.AJAXIFY_CONTAINER_SELECTOR);e&&e.append(this.cartNote.getNote()),this._resizeCart()}},{key:"_addManualCartNote",value:function(){var e=new qe(this.cartPreferences),t=Je.findTargetElement(e.targetSelector()),r=this.cartNote.getNote();Qe.append(r,t,e.targetPlacement()),this._resizeCart()}},{key:"_resizeCart",value:function(){window.ajaxifyShopify&&window.ajaxifyShopify.sizeDrawer&&window.ajaxifyShopify.sizeDrawer()}}])}($e);i(et,"AJAXIFY_CONTAINER_SELECTOR",".ajaxcart__inner");var tt=function(){function e(){t(this,e)}return n(e,[{key:"carts",value:function(t,r){var n=e.AJAXIFY_CART_SELECTOR.join(", "),i=Array.from(document.body.querySelectorAll(n));return this._formElements(i,t,r)}},{key:"_formElements",value:function(e,t,r){var n=[];return e.forEach(function(e){var i=new et(e,t,r);n.push(i)}),n}}])}();i(tt,"AJAXIFY_CART_SELECTOR",["form.ajaxcart","form.ajaxcart-form","form.ajax-cart__form","#AjaxifyCart > form","#ajaxifyCart > form"]);var rt=function(){return n(function e(){t(this,e),this.regularCartLocator=new Ze,this.ajaxifyCartLocator=new tt},[{key:"carts",value:function(e,t,r,n){var i=this.regularCartLocator.carts(e,t,n),o=this.ajaxifyCartLocator.carts(e,t);return this._carts(i,o,r)}},{key:"_carts",value:function(e,t,r){var n=e.concat(t);return null==r?n:this._mergeCarts(r,n)}},{key:"_mergeCarts",value:function(e,t){return t.forEach(function(t){var r=!0;e.forEach(function(e){if(e.equals(t))return r=!1,!1}),r&&e.push(t)}),e}}])}(),nt=function(){return n(function e(r){t(this,e),this.preferences=r,this.cartPreferences=r.cartPreferences(),this.cartLocator=new rt,this.priceConfiguration=new Ne(r),this.carts=[]},[{key:"render",value:function(e,t){for(var r=0;r .nt-swatch, .gecko-swatch, .gt_swatches--select, .product-form__input label, .product-options__value, .product__swatches .swatches__holder > span, .tt-swatches-container-js a, [data-option-type], .gf_swatch, .swatch-selector, .so-variant-change");var ht=function(){function e(r){t(this,e),this.theme=r}return n(e,[{key:"_addVariantChangeListener",value:function(e){it.isDebutifyTheme(this.theme)?ot.observeVariant(e):it.isTurboTheme(this.theme)?st.observeVariant(e):it.isExpressTheme(this.theme)?ut.observeVariant(e):lt.observeVariant(e)}}],[{key:"onThemeVariantChange",value:function(t,r){new e(t)._addVariantChangeListener(r)}}])}(),dt=function(){function e(){t(this,e)}return n(e,null,[{key:"runAfterPageLoading",value:function(t,r){"complete"===document.readyState?e._runDelayed(t,r):e._runOnLoad(t,r)}},{key:"_runOnLoad",value:function(t,r){try{e._runOnLoadSafely(t,r)}catch(e){S.log("Caught error on DelayedExecutor.runAfterPageLoading: "+e)}}},{key:"_runOnLoadSafely",value:function(t,r){window.addEventListener("load",function(){return e._runDelayed(t,r)})}},{key:"_runDelayed",value:function(e,t){t?setTimeout(function(){return e()},t):e()}}])}(),ft=function(){function e(){t(this,e)}return n(e,null,[{key:"getTimestamp",value:function(){return(new Date).getTime()}},{key:"isAfterNow",value:function(t){var r=new Date;return e.isAfterDate(t,r)}},{key:"nowPlusMilliseconds",value:function(t){var r=new Date;return e.datePlusMilliseconds(r,t)}},{key:"addDays",value:function(t,r){var n=t.getTime()+r*e.ONE_DAY_MILLIS;return new Date(n)}},{key:"firstWeekDayAfter",value:function(t,r){var n=t.getUTCDay();return 6===n&&r?e.addDays(t,2):0===n?e.addDays(t,1):t}},{key:"isAfterDate",value:function(e,t){return new Date(e)>t}},{key:"datePlusMilliseconds",value:function(e,t){return e.getTime()+t}}])}();i(ft,"ONE_DAY_MILLIS",864e5);var yt=function(){function e(r,n){t(this,e),this.callback=r,this.listenToAttributeChanges=n,this.dynamicMinCallingPeriod=e.MIN_CALLING_PERIOD,this.lastCall=0,this._armInterval()}return n(e,[{key:"destroy",value:function(){this.observer&&this.observer.disconnect&&(this.observer.disconnect(),this.observer=null)}},{key:"updateParameters",value:function(e){this.callbackParameterObject=e}},{key:"_armInterval",value:function(){var t=this;dt.runAfterPageLoading(function(){return t._addObserver()},e.MIN_CALLING_PERIOD),this._nodeChanged()}},{key:"_addObserver",value:function(){var e=this;this.observer=new MutationObserver(function(){return e._nodeChanged()});var t=document.body,r={attributes:this.listenToAttributeChanges,childList:!0,characterData:!0,subtree:!0};this.observer.observe(t,r)}},{key:"_nodeChanged",value:function(){this._notCalledThisInterval()&&this._invokeCallback()}},{key:"_notCalledThisInterval",value:function(){var e=ft.getTimestamp();return e-this.lastCall>this.dynamicMinCallingPeriod&&(this.lastCall=e,!0)}},{key:"_invokeCallback",value:function(){var e=ft.getTimestamp();this.callback(this.callbackParameterObject);var t=ft.getTimestamp()-e;this._updateMinCallingPeriod(t)}},{key:"_updateMinCallingPeriod",value:function(t){var r=3*t;this.dynamicMinCallingPeriod=Math.max(e.MIN_CALLING_PERIOD,r)}}])}();i(yt,"MIN_CALLING_PERIOD",150);var mt=function(){function e(r){t(this,e),this.callback=r,this.timer=null,this._armInterval()}return n(e,[{key:"updateParameters",value:function(e){this.callbackParameterObject=e}},{key:"_armInterval",value:function(){var t=this;this.timer?this._reArmInterval():this.timer=setTimeout(function(){t.callback(t.callbackParameterObject),t._reArmInterval()},e.CHECKUP_SAFE_DELAY)}},{key:"_reArmInterval",value:function(){var t=this;this._clearInterval(),this.timer=setInterval(function(){t.callback(t.callbackParameterObject)},e.CHECKUP_SAFE_DELAY)}},{key:"_clearInterval",value:function(){clearInterval(this.timer)}}])}();i(mt,"CHECKUP_SAFE_DELAY",1500);var pt=function(){function e(r,n,i,o){t(this,e),this.enabled=i,this._addVariantChangeCallback(r,n),this._addConvertSelectorsCallback(o,n),this.enabled&&this._startWhenPageFinishesLoading(n)}return n(e,[{key:"updateParameters",value:function(e){this.enabled&&(this.impl?(this.impl.updateParameters(e),this.parametersBuffer=null):this.parametersBuffer=e)}},{key:"_addVariantChangeCallback",value:function(e,t){ht.onThemeVariantChange(e,function(){setTimeout(t,400),setTimeout(t,1e3)})}},{key:"_addConvertSelectorsCallback",value:function(e,t){P.isEmpty(e)||Ee.addBodyEventsToAll(e,"mousedown touch change",function(){setTimeout(t,150),setTimeout(t,1e3),setTimeout(t,2500)})}},{key:"_startWhenPageFinishesLoading",value:function(t){var r=this;dt.runAfterPageLoading(function(){return r._instantiateImpl(t)},e.LOADING_DELAY)}},{key:"_instantiateImpl",value:function(e){window.MutationObserver?this.impl=new yt(e,!1):this.impl=new mt(e),this.parametersBuffer&&this.impl.updateParameters(this.parametersBuffer)}}])}();i(pt,"LOADING_DELAY",1500);var vt=function(){function e(r,n){t(this,e),this.shortOptionName=r.menuShortNames,this.colour=r.colour,this.bgColour=r.bgColour,this.showBorder=r.showBorder,this.borderColour=r.borderColour,this.menuAdditionalStyles=r.menuAdditionalStyles,this.showFlag=r.showFlag,this.menuFlagSize=r.menuFlagSize,this.showCurrency=r.showCurrency,this.showArrow=r.showArrow,this.whiteArrow=r.whiteArrow,this.currencyChooser=n,this.button=this._initialize()}return n(e,[{key:"selectCurrency",value:function(e){if(this.showCurrency){var t=" "+fe.getCurrencyName(e,this.shortOptionName);this.buttonText.textContent=t}this.showFlag&&de.updateFlag(this.buttonFlag,e.code,this.menuFlagSize)}},{key:"getButtonElement",value:function(){return this.button}},{key:"_initialize",value:function(){var e=this._create();return this._enableCurrencyButtonChooser(e),e}},{key:"_create",value:function(){var t=document.createElement("span");return t.classList.add(e.CURRENCY_BUTTON_CLASS),Pe.addDeviceClasses(t),t.classList.add(he.GOOGLE_SKIP_TRANSLATE_INHIBIT_CLASS),t.classList.add(he.GOOGLE_NO_TRANSLATE_INHIBIT_CLASS),t.style.cursor="pointer",t.style.whiteSpace="nowrap",t.style.margin="2px",t.style.padding="5px",t.style.minWidth="24px",t.style.minHeight="24px",t.style.color=this.colour,t.style.backgroundColor=this.bgColour,this.showFlag&&(this.buttonFlag=de.flagElement(e.NO_COUNTRY,this.menuFlagSize),t.append(this.buttonFlag)),this.showCurrency&&(this.buttonText=document.createElement("span"),this.buttonText.classList.add(e.CURRENCY_BUTTON_TEXT_CLASS),this.buttonText.style.marginRight="3px",t.append(this.buttonText)),this.showArrow&&t.append(de.upDownIconElement(this.whiteArrow)),ye.apply(t,this.menuAdditionalStyles),this._configureEvents(t),this.showBorder&&this._addBorderStyles(t,this.borderColour),t}},{key:"_configureEvents",value:function(e){e.addEventListener("mouseover",function(){return e.style.opacity="0.8"}),e.addEventListener("mouseout",function(){return e.style.opacity="1"})}},{key:"_addBorderStyles",value:function(e,t){e.style.border="solid 1px "+t,e.style.borderRadius="4px",e.style.boxShadow="1px 1px 1px "+t,e.addEventListener("mouseover",function(){return e.style.boxShadow="2px 2px 4px "+t}),e.addEventListener("mouseout",function(){return e.style.boxShadow="1px 1px 1px "+t})}},{key:"_enableCurrencyButtonChooser",value:function(e){this.currencyChooser.attachTo(e)}}])}();i(vt,"CURRENCY_BUTTON_CLASS","currency-converter-currency-button"),i(vt,"CURRENCY_BUTTON_TEXT_CLASS","currency-converter-currency-button-text"),i(vt,"NO_COUNTRY","XX");var _t=function(){return n(function e(){t(this,e)},null,[{key:"width",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||800}},{key:"height",value:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||600}}])}(),gt=function(){function e(r){t(this,e),this.preferences=r}return n(e,[{key:"placeElement",value:function(e){this._renderElement(e),this._floatElement(e),this._makeElementVisible(e)}},{key:"_renderElement",value:function(e){e.style.position="fixed",document.body.prepend(e)}},{key:"_floatElement",value:function(e){var t=this._truncatedHorizontalOffset(e),r=this._truncatedVerticalOffset(e),n=this._fixedPosition();"TOP_LEFT"==n?(e.style.top=r+"px",e.style.left=t+"px",$.addImportantCssToElement(e,"bottom","unset"),$.addImportantCssToElement(e,"right","unset")):"TOP_RIGHT"==n?(e.style.top=r+"px",e.style.right=t+"px",$.addImportantCssToElement(e,"bottom","unset"),$.addImportantCssToElement(e,"left","unset")):"BOTTOM_LEFT"==n?(e.style.bottom=r+"px",e.style.left=t+"px",$.addImportantCssToElement(e,"top","unset"),$.addImportantCssToElement(e,"right","unset")):(e.style.bottom=r+"px",e.style.right=t+"px",$.addImportantCssToElement(e,"top","unset"),$.addImportantCssToElement(e,"left","unset"))}},{key:"_makeElementVisible",value:function(t){t.style.zIndex=e.Z_INDEX,this._sendPossibleAdminBarBehindIfNeeded()}},{key:"_fixedPosition",value:function(){return R.isMobileOrTabletPortrait()&&this.preferences.mobileFixedPosition?this.preferences.mobileFixedPosition:this.preferences.fixedPosition}},{key:"_truncatedHorizontalOffset",value:function(e){var t=this._horizontalOffset(),r=Ke.outerWidthWithMargins(e),n=t+r,i=document.body.clientWidth;return n>i?i-r:t}},{key:"_truncatedVerticalOffset",value:function(t){var r=this._verticalOffset(),n=Ke.outerHeightWithMargins(t),i=r+n,o=_t.height();return i>o?e.VERTICAL_SCREEN_RATIO*(o-n):r}},{key:"_horizontalOffset",value:function(){return R.isMobileOrTabletPortrait()&&this.preferences.mobileFixedPosition?this.preferences.mobileHorizontalOffset:this.preferences.horizontalOffset}},{key:"_verticalOffset",value:function(){return R.isMobileOrTabletPortrait()&&this.preferences.mobileFixedPosition?this.preferences.mobileVerticalOffset:this.preferences.verticalOffset}},{key:"_sendPossibleAdminBarBehindIfNeeded",value:function(){var t=e.Z_INDEX-1;"BOTTOM_LEFT"==this._fixedPosition()&&M.addStyles("#admin-bar-iframe { z-index: "+t+" !important; }")}}])}();i(gt,"Z_INDEX",1e8),i(gt,"VERTICAL_SCREEN_RATIO",.75);var Ct=function(){function e(r,n,i){t(this,e),this.currencyButtonPreferences=r,this.updateParameters(n),this.currencyChooser=i,this._bindRerenderEvents()}return n(e,[{key:"render",value:function(){this._renderButton()}},{key:"selectCurrency",value:function(){if(this.currencyButton){var e={name:this.conversionParameters.name,code:this.conversionParameters.code};this.currencyButton.selectCurrency(e)}}},{key:"updateParameters",value:function(e){this.conversionParameters=e}},{key:"_isAlreadyPlaced",value:function(){return!!this.currencyButton&&this.currencyButton.getButtonElement().isConnected}},{key:"_renderButton",value:function(){this.currencyButtonPreferences.showMenuButton&&!this._isAlreadyPlaced()&&(this._hasFixedPosition()?this._placeFixedElement():this._placeAbsoluteElement(),this.selectCurrency())}},{key:"_bindRerenderEvents",value:function(){var e=this;window.document.addEventListener("cart:update",function(){return e._delayedRerender(0)})}},{key:"_delayedRerender",value:function(e){var t=this;setTimeout(function(){t._renderButton()},e)}},{key:"_addBodyClass",value:function(){var t=R.isMobileOrTabletPortrait()?e.MOBILE_BUTTON_CLASS:e.DESKTOP_BUTTON_CLASS;document.body.classList.add(t)}},{key:"_hasFixedPosition",value:function(){return R.isMobileOrTabletPortrait()&&this.currencyButtonPreferences.mobilePositionType?"FIXED"==this.currencyButtonPreferences.mobilePositionType:"FIXED"==this.currencyButtonPreferences.positionType}},{key:"_placeAbsoluteElement",value:function(){var e=new qe(this.currencyButtonPreferences),t=Je.findTargetElement(e.targetSelector());if(t){this.currencyButton=new vt(this.currencyButtonPreferences,this.currencyChooser),Qe.append(this.currencyButton.getButtonElement(),t,e.targetPlacement()),this._addBodyClass();var r=Me.menuButtonRendered(this.currencyButtonPreferences);Ue.triggerMenuButtonRenderedEvent(r)}else S.log("The currency converter button was not loaded because the target element does not exist")}},{key:"_placeFixedElement",value:function(){this.currencyButton=new vt(this.currencyButtonPreferences,this.currencyChooser),new gt(this.currencyButtonPreferences).placeElement(this.currencyButton.getButtonElement()),this._addBodyClass();var e=Me.menuButtonRendered(this.currencyButtonPreferences);Ue.triggerMenuButtonRenderedEvent(e)}}])}();i(Ct,"DESKTOP_BUTTON_CLASS","cbb-desktop-button"),i(Ct,"MOBILE_BUTTON_CLASS","cbb-mobile-button");var Et=function(){function e(){t(this,e)}return n(e,null,[{key:"get",value:function(e){try{var t=localStorage.getItem(e);return localStorage.getItem(e)?JSON.parse(t):null}catch(e){return null}}},{key:"set",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){}}},{key:"setItem",value:function(e,t){try{localStorage.setItem(e,t)}catch(e){}}},{key:"hasItem",value:function(t){var r=e.getItem(t);return r&&null!=r}},{key:"getItem",value:function(e){try{return localStorage.getItem(e)}catch(e){return null}}},{key:"removeItem",value:function(e){try{return localStorage.removeItem(e)}catch(e){}}}])}(),St=function(){function e(){t(this,e)}return n(e,null,[{key:"save",value:function(t,r){if(r){var n={value:r,expirationTimeMillis:ft.nowPlusMilliseconds(e.ONE_MONTH)};Et.setItem(t,JSON.stringify(n))}}},{key:"load",value:function(t){var r=JSON.parse(Et.getItem(t));return e.isDataAlive(r)?r.value:null}},{key:"remove",value:function(e){Et.removeItem(e)}},{key:"isDataAlive",value:function(e){if(e){var t=e.expirationTimeMillis;return t&&ft.isAfterNow(t)}return!1}},{key:"hasItem",value:function(t){var r=e.load(t);return r&&null!=r}}])}();i(St,"ONE_MONTH",2592e6);var kt=function(){function e(){t(this,e)}return n(e,null,[{key:"saveCurrency",value:function(t){St.save(e.CURRENCY,t)}},{key:"saveCountry",value:function(t){St.save(e.COUNTRY,t)}},{key:"saveRefreshCountry",value:function(t){St.save(e.REFRESH_COUNTRY,t)}},{key:"saveRefreshTimestamp",value:function(){var t=ft.getTimestamp();St.save(e.REFRESH_TIMESTAMP,t)}},{key:"loadCurrency",value:function(){return St.load(e.CURRENCY)}},{key:"loadCountry",value:function(){return St.load(e.COUNTRY)}},{key:"loadRefreshCountry",value:function(){return St.load(e.REFRESH_COUNTRY)}},{key:"loadRefreshTimestamp",value:function(){return St.load(e.REFRESH_TIMESTAMP)}},{key:"existsCurrency",value:function(){return St.hasItem(e.CURRENCY)}},{key:"existsRefreshCountry",value:function(){return St.hasItem(e.REFRESH_COUNTRY)}}])}();i(kt,"CURRENCY","cbb-currency-converter-currency"),i(kt,"COUNTRY","cbb-currency-converter-country"),i(kt,"REFRESH_COUNTRY","cbb-currency-converter-refresh-country"),i(kt,"REFRESH_TIMESTAMP","cbb-currency-converter-refresh-timestamp");var Pt=function(){function e(){t(this,e)}return n(e,[{key:"saveRefreshInformation",value:function(e){kt.saveRefreshCountry(e),kt.saveRefreshTimestamp()}},{key:"riskOfInfiniteRefreshLoop",value:function(e){return S.debug("[InfiniteRefreshLoopPreventer] Checking possible infinite loop for "+e),this._noPreviousData()?(S.debug("[InfiniteRefreshLoopPreventer] It is OK because there is no previous data"),!1):this._previousCountryWasDifferent(e)?(S.debug("[InfiniteRefreshLoopPreventer] It is OK because last country was different"),!1):this._lastRefreshWasLongAgo()?(S.debug("[InfiniteRefreshLoopPreventer] It is OK because last reload was long ago"),!1):(S.debug("[InfiniteRefreshLoopPreventer] Possible infinite loop prevented"),!0)}},{key:"_noPreviousData",value:function(){return!kt.existsCurrency()||!kt.existsRefreshCountry()}},{key:"_previousCountryWasDifferent",value:function(e){return kt.loadRefreshCountry()!==e}},{key:"_lastRefreshWasLongAgo",value:function(){return kt.loadRefreshTimestamp()+e.ONE_MINUTE_IN_MILLIS0}}])}(),It=function(){return n(function e(){t(this,e)},null,[{key:"configure",value:function(e,t){Nt.isInstalled(e)&&t.configure()}},{key:"configureAlways",value:function(e){e.configure()}}])}(),Ot=function(){function e(r){t(this,e),this.condition=r}return n(e,[{key:"nowAndEvery",value:function(e){return this.checkInitially=!0,this.intervalMillis=e,this}},{key:"every",value:function(e){return this.checkInitially=!1,this.intervalMillis=e,this}},{key:"during",value:function(e){return this.timeoutMillis=e,this}},{key:"then",value:function(e){return this.okCallback=e,this}},{key:"otherwise",value:function(e){return this.failCallback=e,this}},{key:"watch",value:function(){var t=this;if(this.checkInitially&&this.condition())this.okCallback();else{var r=setInterval(function(){t.condition()&&(e._removeInterval(r),t.okCallback())},this.intervalMillis);this.timeoutMillis?setTimeout(function(){e._removeInterval(r),t._executeFailCallbackSafely()},this.timeoutMillis):this._executeFailCallbackSafely()}}},{key:"_executeFailCallbackSafely",value:function(){!this.condition()&&this.failCallback&&this.failCallback()}}],[{key:"_removeInterval",value:function(e){e&&clearInterval(e)}},{key:"checkIf",value:function(t){return new e(t)}},{key:"checkIndefinitelyIf",value:function(t){return new e(t).during(e.INFINITE)}}])}();i(Ot,"INFINITE",0);var Lt=function(){function e(){t(this,e)}return n(e,[{key:"configure",value:function(){var t=this;Ot.checkIndefinitelyIf(function(){return t._isFSBVisible()}).every(e.SECOND).then(function(){return t._normaliseFSBPrices()}).watch()}},{key:"_isFSBVisible",value:function(){return this._isBarVisible()&&this._isPriceVisible()}},{key:"_isBarVisible",value:function(){var e=document.querySelector("#fsb_bar");return e&&Ke.isVisible(e)}},{key:"_isPriceVisible",value:function(){var e=document.querySelector("#fsb_amount");return e&&ee.isAProductPrice(e)}},{key:"_normaliseFSBPrices",value:function(){var e=this._readCurrencySymbol();null!==e&&(this._removeSymbolElement(),this._formatAmountWithSymbol(e))}},{key:"_readCurrencySymbol",value:function(){var e=document.querySelector("#fsb_symbol");return e?e.textContent:null}},{key:"_removeSymbolElement",value:function(){document.querySelector("#fsb_symbol").remove()}},{key:"_formatAmountWithSymbol",value:function(e){var t=e+document.querySelector("#fsb_amount").textContent;document.querySelector("#fsb_amount").textContent=t}}])}();i(Lt,"SECOND",1e3);var Ft=function(){return n(function e(){t(this,e)},[{key:"configure",value:function(){M.addStyles(".bkt--dialog { \n z-index: 100 !important; \n} \n")}}])}(),Dt=function(){return n(function e(){t(this,e)},[{key:"configure",value:function(){document.querySelectorAll(".Bold-theme-hook-DO-NOT-DELETE, .Makebecool-theme-hook-DO-NOT-DELETE").forEach(function(e){return e.remove()}),document.querySelectorAll(".BOLD-mc-picker-mnt, .BOLD-mc-picker").forEach(function(e){return e.remove()})}}])}(),Bt=function(){return n(function e(){t(this,e)},[{key:"configure",value:function(){document.querySelectorAll(".doubly-wrapper").forEach(function(e){return e.remove()}),document.querySelectorAll(".doubly-message").forEach(function(e){return e.remove()})}}])}(),Mt=function(){return n(function e(){t(this,e)},[{key:"configure",value:function(){document.querySelectorAll(".pick_currency, .pick_currency_visible").forEach(function(e){return e.remove()}),document.querySelectorAll(".mlvedaCartNote").forEach(function(e){return e.remove()})}}])}(),Ut=function(){return n(function e(){t(this,e)},null,[{key:"configureSupportedApps",value:function(){It.configure(xt.FREE_SHIPPING_BAR,new Lt),It.configure(xt.BOOST_SALES,new Ft),It.configureAlways(new Dt),It.configureAlways(new Bt),It.configureAlways(new Mt)}}])}(),Wt=function(){return n(function e(){t(this,e)},null,[{key:"watch",value:function(e,t){if("function"==typeof t){var r,n=Ce.isValid(e);if(n)r=Ce.exists.bind(Ce,e);else{if("function"!=typeof e)return void S.log("API.watch error, please provide a proper target (string or function)");r=e}Ot.checkIf(function(){return r()}).nowAndEvery(100).during(6e4).then(function(){var r=null;n&&(r=document.querySelector(e)),t(r)}).watch()}else S.log("API.watch error, please provide a proper callback")}},{key:"on",value:function(e,t,r){Ee.addBodyEventsToAll(t,e,r)}}])}(),Gt=function(){return n(function e(r,n,i,o){t(this,e),this.stopCallback=r,this.startCallback=n,this.convertPricesCallback=i,this.renderButtonCallback=o},[{key:"enableDebug",value:function(){S.enableDebug()}},{key:"disableDebug",value:function(){S.disableDebug()}},{key:"stop",value:function(){this.stopCallback()}},{key:"start",value:function(){this.startCallback()}},{key:"convertPrices",value:function(){this.convertPricesCallback()}},{key:"renderButton",value:function(){this.renderButtonCallback()}},{key:"watch",value:function(e,t){Wt.watch(e,t)}},{key:"on",value:function(e,t,r){Wt.on(e,t,r)}}])}(),Ht=function(){return n(function e(){t(this,e),this.body=window.document.body,this.domRect=this.body.getBoundingClientRect()},[{key:"height",value:function(){return this.domRect.height}}])}(),Vt=function(){function e(r){t(this,e),this.preferences=r,this.stopExecution=!1,this.started=!1}return n(e,[{key:"init",value:function(){this._addScripts(),this.stopExecution||this._start()}},{key:"_addScripts",value:function(){this._setApiAccess(),B.addPageClassToBody(),U.addScripts(d.appId(),this.preferences.customCss,this.preferences.customJs)}},{key:"_start",value:function(){this.started=!0;var e=Date.now();this.bodySize=new Ht,this.currencyRatios=this.preferences.currencyRatios(),this.conversionResolver=new H(this.currencyRatios,this.preferences.chooserCurrencies,this.preferences.autodetectedCurrencyAvailable,this.preferences.defaultCurrency,this.preferences.shopCurrency,this.preferences.autodetectedCurrency);var t=this.preferences.currencyChooserPreferences().chooserShortNames;this.currencyChooser=Se.getChooser(this.preferences.currencyChooserPreferences(),t,this.bodySize,this._currencyChooserCallback()),this.priceReplacer=new we(this.preferences.amountBoxPreferences(),this.currencyChooser),this.amountBoxAppender=new Re(this.preferences.amountBoxPreferences(),this.currencyChooser),this.priceService=new Ve(this.preferences,this.amountBoxAppender,this.priceReplacer),this.cartService=new nt(this.preferences),this.priceObserver=new pt(this.preferences.theme,this._convertPricesCallback(),this.preferences.checkDynamicPrices,this.preferences.convertSelectors),this._preloadIcons(this.preferences);var r=this.preferences.currencyButtonPreferences(),n=r.menuShortNames;this.menuCurrencyChooser=Se.getMenuButtonChooser(this.preferences.currencyChooserPreferences(),n,this.bodySize,r,this._currencyChooserCallback()),this.preferences.isMultiCurrencyEnabled()&&(this.multiCurrencyService=new Rt(this.preferences.shopCurrency,this.preferences.shopCountry,this.preferences.customerCountry,this.preferences.enabledPresentmentCurrencies)),kt.saveCountry(this.preferences.customerCountry),this._forceCurrencyFromUrl(),this.parameters=this.conversionResolver.conversionParameters(kt.loadCurrency()),this.preferences.isMultiCurrencyEnabled()&&this.multiCurrencyService.changeActiveCurrencyAndRefreshIfNecessary(this.parameters.code),this.currencyButtonService=new Ct(r,this.parameters,this.menuCurrencyChooser),this._convertPrices(),this.currencyChooser.render(),this.currencyButtonService.render(),this.menuCurrencyChooser.render(),this._highlightCurrency(),Ut.configureSupportedApps();var i=Date.now();S.debug("Starting Currency Converter Plus took "+(i-e)+" ms")}},{key:"_preloadIcons",value:function(e){e.isUpdownIconEnabled()&&de.preloadUpdownIcon(),e.isWhiteUpdownIconEnabled()&&de.preloadWhiteUpdownIcon()}},{key:"_forceCurrencyFromUrl",value:function(){var e=_.get("currency");e&&this.currencyRatios.getCurrency(e)&&(kt.saveCurrency(e),this.preferences.isMultiCurrencyEnabled()&&this.multiCurrencyService.changeActiveCurrencyAndRefreshIfNecessary(e))}},{key:"_convertPrices",value:function(){var e=Date.now();this.priceService.processPrices(this.parameters),this.cartService.processCarts(this.parameters),this.priceService.render(),this.cartService.render(this.parameters,this.currencyRatios);var t=Date.now();S.debug("Converting prices took "+(t-e)+" ms")}},{key:"_updatePrices",value:function(){var e=Date.now();this.priceService.updatePrices(this.parameters),this.cartService.updateCarts(this.parameters,this.currencyRatios);var t=Date.now();S.debug("Updating prices took "+(t-e)+" ms")}},{key:"_highlightCurrency",value:function(){this.preferences.showChooser&&this.currencyChooser.highlightCurrency(this.parameters.code),this.preferences.showMenuButton&&(this.currencyButtonService.updateParameters(this.parameters),this.currencyButtonService.selectCurrency(),this.menuCurrencyChooser.highlightCurrency(this.parameters.code))}},{key:"_currencyChooserCallback",value:function(){var e=this;return function(t){var r=Me.currencyChange(e.preferences,t);Ue.triggerCurrencyChangeEvent(r),e.preferences.isMultiCurrencyEnabled()&&e.multiCurrencyService.changeActiveCurrencyAndRefreshIfNecessary(t),kt.saveCurrency(t),e.parameters=e.conversionResolver.conversionParameters(t),e._updatePrices(),e._highlightCurrency(),e.priceObserver.updateParameters(e.parameters)}}},{key:"_setApiAccess",value:function(){var t=new Gt(this._stopCallback(),this._startCallback(),this._convertPricesCallback(),this._renderButtonCallback());l.setProperty(e.API_ID,t)}},{key:"_stopCallback",value:function(){var e=this;return function(){e.started?S.log("Currency Converter Plus execution cannot be stopped via API because it was started before"):(S.debug("Currency Converter Plus execution was stopped via API"),e.stopExecution=!0)}}},{key:"_startCallback",value:function(){var e=this;return function(){e.stopExecution?e.started?S.log("Currency Converter Plus execution cannot be started via API because it was started before"):(S.debug("Currency Converter Plus execution was resumed via API"),e._start()):S.log("Currency Converter Plus execution cannot be resumed via API because it was not stopped before")}}},{key:"_convertPricesCallback",value:function(){var e=this;return function(){e.parameters=e.conversionResolver.conversionParameters(kt.loadCurrency()),e._convertPrices(),e._highlightCurrency()}}},{key:"_renderButtonCallback",value:function(){var e=this;return function(){e.currencyButtonService.render()}}}])}();i(Vt,"API_ID",d.appId()+"Api");var zt=function(){function e(){t(this,e)}return n(e,null,[{key:"gatherCurrencyConverterPlusTranslations",value:function(){var t=l.getProperty("currency-converter-plusTranslations");return e._thereAreNoTranslations(t)?null:t}},{key:"_thereAreNoTranslations",value:function(e){return!e||0===Object.keys(e).length}}])}(),Yt=function(){return n(function e(r){t(this,e),this.metafields=r},[{key:"into",value:function(e){return this.preferences=e,this._mergeCartNoteText(),this.preferences}},{key:"_mergeCartNoteText",value:function(){var e=this.metafields.cart_note_text;e&&(this.preferences.cart_note_text=e)}}])}(),Xt=function(){return n(function e(r){t(this,e),this.jsonPreferences=r},[{key:"mergeTranslationsIntoPreferences",value:function(){if(!this.jsonPreferences.preferences[0].app_translation_support)return this.jsonPreferences;var e=zt.gatherCurrencyConverterPlusTranslations();return e?(this.jsonPreferences.preferences[0]=new Yt(e).into(this.jsonPreferences.preferences[0]),S.debug("Currency Converter Plus widget translations successfully merged into preferences")):S.debug("Could not gather Currency Converter Plus widget translations from the store metadata"),this.jsonPreferences}}])}();new(function(){return n(function e(){var r=this;t(this,e);var n=d.appId();h.hasLoadedBefore(n)||new E(n).load(this._requestParams()).then(function(e){return r._loadWidgetTranslationsFromActiveMarket(e)}).then(function(e){return new I(e)}).then(function(e){return r._init(e)}).catch(function(e){return S.log("Error when starting Currency Converter Plus: "+e)})},[{key:"_requestParams",value:function(){var e=kt.loadCountry();return e?{countryCode:e}:{}}},{key:"_loadWidgetTranslationsFromActiveMarket",value:function(e){return new Xt(e).mergeTranslationsIntoPreferences()}},{key:"_init",value:function(e){e.hasRates()?new Vt(e).init():S.log("No currencies loaded")}}])}())}("undefined"==typeof widgets?widgets={}:widgets);