{
  "version": 3,
  "sources": ["/cdn/shop/t/29/assets/custom.js?enable_js_minification=1"],
  "sourcesContent": ["/*\n* Pipeline Theme\n*\n* Use this file to add custom Javascript to Pipeline.  Keeping your custom\n* Javascript in this fill will make it easier to update Pipeline. In order\n* to use this file you will need to open layout/theme.liquid and uncomment\n* the custom.js script import line near the bottom of the file.\n*\n*/\n\n\nconst DOMAIN_COUNTRY = (location.href.indexOf('.ca') > -1) ? 'CA' : 'US';\nconst COUNTRIES = {\n    US: {\n        url: 'https://nelliesclean.com/',\n        imgUrl: 'https://cdn.shopify.com/s/files/1/0074/5517/8821/files/Nellie_s-Pop-Up-USA.jpg?v=1651000399',\n        imgAlt: 'Looks like you&apos;re in the USA. Take me to nelliesclean.ca'\n    },\n    CA: {\n        url: 'https://nelliesclean.ca/',\n        imgUrl: 'https://cdn.shopify.com/s/files/1/0074/5517/8821/files/Untitled-1.jpg?v=1650997265',\n        imgAlt: 'Looks like you&apos;re in Canada. Take me to nelliesclean.ca'\n    }\n};\nconst SEARCH_PARAMS = new URLSearchParams(window.location.search);\n\n\nconst createCookie = (name,value,days) => {\n    if (days) {\n        var date = new Date();\n        date.setTime(date.getTime()+(days*24*60*60*1000));\n        var expires = \"; expires=\"+date.toGMTString();\n    }\n    else var expires = \"\";\n    document.cookie = name+\"=\"+value+expires+\"; path=/\";\n}\n\nconst readCookie = (name) => {\n    var nameEQ = name + \"=\";\n    var ca = document.cookie.split(';');\n    for(var i=0;i < ca.length;i++) {\n        var c = ca[i];\n        while (c.charAt(0)==' ') c = c.substring(1,c.length);\n        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);\n    }\n    return null;\n}\n\nconst eraseCookie = (name) => {\n    createCookie(name,\"\",-1);\n}\n\nconst countrySwitcherPopup = {\n    init(locationCountry) {\n        this.countryData = COUNTRIES[locationCountry];\n        this.$sbCountrySwitcherPopup = $(`\n            <div class=\"sb-country-switcher-popup\">\n                <div class=\"sb-country-switcher-popup__inner\">\n                    <a href=\"${this.countryData.url}\">\n                        <img src=\"${this.countryData.imgUrl}\" alt=\"${this.countryData.imgAlt}\" width=\"600px\">\n                    </a>\n                </div>\n            </div>\n            <style>\n                .sb-country-switcher-popup {\n                  background: rgba(0,0,0,.5);\n                  height: 100%;\n                  left: 0;\n                  position: fixed;\n                  top: 0;\n                  width: 100%;\n                  z-index: 9999;\n                }\n                .sb-country-switcher-popup__inner {\n                  border-radius: 5px;\n                  box-shadow: 0 0 10px 5px rgba(0,0,0,.3);\n                  line-height: 0;\n                  margin: 2rem auto;\n                  max-width: 600px;\n                  position: relative;\n                  top: 33.333%;\n                  transform: translateY(-50%);\n                  width: calc(100% - 2rem);\n                }\n                .sb-country-switcher-popup__inner:after {\n                  content: '\\\\2715';\n                  cursor: pointer;\n                  position: absolute;\n                  pointer-events: none;\n                  top: -2rem;\n                  right: 0;\n                  color: #fff;\n                  font-weight: bold;\n                  font-size: 2rem;\n                  line-height: 2rem;\n                }\n                .sb-country-switcher-popup img {\n                  border-radius: 5px;\n                }\n            </style>`);\n        this.$sbCountrySwitcherPopupInner = this.$sbCountrySwitcherPopup.children('.sb-country-switcher-popup__inner');\n        this.disabled = readCookie('countrySwitcherDisabled');\n\n        if (SEARCH_PARAMS.has('sent') && SEARCH_PARAMS.get('sent') == 'true') {\n            createCookie('countrySwitcherDisabled', 'true', 7);\n            this.disabled = true;\n        }\n        \n        if (!this.disabled) {\n            this.open();\n            this.$sbCountrySwitcherPopup.click(function () {\n                countrySwitcherPopup.close();\n            });\n            this.$sbCountrySwitcherPopupInner.click(function (e) {\n                e.stopPropagation();\n            });\n            $(document).keyup(function(e) {\n                 if (e.key === \"Escape\") {\n                    countrySwitcherPopup.close();\n                }\n            });\n        }\n    },\n    open() {\n        $('body').append(this.$sbCountrySwitcherPopup);\n    },\n    close() {\n        this.$sbCountrySwitcherPopup.hide();\n        createCookie('countrySwitcherDisabled', 'true', 7);\n    }\n};\n\n\n\n$(document).ready(function () {\n\n    $.get(\"https://ipinfo.io/json\", function (response) {\n        const LOCATION_COUNTRY = response.country;\n        if (LOCATION_COUNTRY != DOMAIN_COUNTRY) {\n            // countrySwitcherPopup.init(LOCATION_COUNTRY); // PAUSED Nov 13 2026 for scent quiz popup - remove the leading // to turn the country redirect popup back on (~Dec 13)\n        }\n    },\"jsonp\");\n\n});\n\n\nfunction updateTotal() {\n  var variantId = $('.shopify-product-form input[name=\"id\"]').val();\n  var selectedVariant = product.variants.find(({id}) => id == variantId);\n  var quantity = $('.shopify-product-form .quantity__input').val();\n  var variantPrice = selectedVariant.price;\n  var totalPrice = quantity * variantPrice;\n  var totalPriceFormatted = totalPrice ? themeVendor.themeCurrency.formatMoney(totalPrice) : null;\n  var $price = $('[data-product-price]');\n\n  $price.text(totalPriceFormatted);\n}\n\n\n// wait for PDP forms to load\ndocument.addEventListener('theme:resize', () => {\n\n  // update price-per-unit on variant change (PDP)\n  $('.shopify-product-form input[name=\"id\"]').on('change', function() {\n    var variantId = this.value;\n    var selectedVariant = product.variants.find(({id}) => id == variantId);\n    var $priceWrapper = document.getElementById('product__price--per-cost-wrapper');\n  \n    if (selectedVariant) {\n      var costPerNumber = parseInt(selectedVariant.metafields.custom.cost_per_number);\n      var divisor = costPerNumber / 1.0;\n      var pricePer = selectedVariant.price / divisor;\n      var pricePerFormatted = pricePer ? themeVendor.themeCurrency.formatMoney(pricePer) : null;\n      var unitType = product.metafields.custom.cost_per_unit_type;\n  \n      if (pricePerFormatted && unitType) {\n        $priceWrapper.textContent = pricePerFormatted + ' per ' + unitType;\n      } else {\n        $priceWrapper.textContent = '';\n      }\n\n      setTimeout(updateTotal, 0);\n    }\n  });\n\n  // update total on quantity change\n  $('.shopify-product-form .quantity__input').on('change', updateTotal);\n  \n});\n\n\n"],
  "mappings": "AAWA,MAAM,eAAkB,SAAS,KAAK,QAAQ,KAAK,EAAI,GAAM,KAAO,KAC9D,UAAY,CACd,GAAI,CACA,IAAK,4BACL,OAAQ,8FACR,OAAQ,+DACZ,EACA,GAAI,CACA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