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vD,KAAKuD,QAAQR,cAAckH,OAAS,EACvD,OAGF,MAAMoB,EAAiBrL,KAAKuD,QAAQR,cAAc,GAAGpB,KAC/C2J,EAAkBtL,KAAKF,gBAAgBuL,GAOvC9G,EAAWvE,KAAKuD,QAAQgB,SAC3BgH,OAAO9G,GAAWA,EAAQuE,UAAYsC,GACzC,IAAK,MAAM7G,KAAWF,EAAU,CAC9B,MAAM0E,EAAUxE,EAAQwE,QAClBuC,EAAQxL,KAAKkB,WAAWC,cAC5B,wDAAwD8H,aAErDuC,IAID/G,EAAQqF,UACV0B,EAAMpC,UAAUqC,OAAO,gBAEvBD,EAAMpC,UAAUC,IAAI,gBAExB,CACF,EAQF,SAASI,EAAa5G,GACpB,OAAOA,EAAO0B,SAASmH,MAAMjH,IAAYA,EAAQqF,UACnD,CAEA,SAAStB,EAAeI,GACtB,OAAOA,EAAM+C,QAAQ,MAAO,IAC9B,CA0UKC,eAAeC,IAAI,mCACtBD,eAAeE,OAAO,iCAAkCnM","sources":["webpack://lange/webpack/bootstrap","webpack://lange/webpack/runtime/jsonp chunk loading","webpack://lange/./sections/product-variant-selector-modal/product-variant-selector-modal/index.html","webpack://lange/./sections/product-variant-selector-modal/product-variant-selector-modal/index.ts"],"sourcesContent":["// The module cache\nlet __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tlet cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tlet module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.b = (typeof document !== 'undefined' && document.baseURI) || self.location.href;\n\n// no installed chunks\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// no jsonp function","// Imports\nvar ___HTML_LOADER_IMPORT_0___ = new URL(\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\", import.meta.url);\n// Module\nvar code = \"<div style=\\\"display: flex; flex-direction: column;\\\"><close-button style=\\\"position: absolute;\\\"></close-button><img width=\\\"320\\\" height=\\\"400\\\" src=\\\"\" + ___HTML_LOADER_IMPORT_0___ + \"\\\" alt=\\\"\\\" style=\\\"display: block; aspect-ratio: 4/5; max-width: 320px; width: 90%; margin: 0 auto 12px; object-fit: contain;\\\"><header style=\\\"margin-bottom: 12px;\\\"><h2 class=\\\"title\\\" style=\\\"font-weight: 700; font-size: 1.5rem; line-height: 1.4; margin: 0;\\\"></h2><p class=\\\"subtitle\\\" style=\\\"font-size: 1.125rem; line-height: 1.5; margin: 0;\\\"></p></header><div style=\\\"margin-bottom: 12px;\\\"><product-rating-stars data-average=\\\"\\\" data-count=\\\"\\\"></product-rating-stars></div><div class=\\\"variant-options\\\" hidden style=\\\"margin-bottom: 12px;\\\"></div><div class=\\\"backorder\\\" hidden style=\\\"color: #616161; font-size: 0.875rem; font-weight: 400; line-height: 1.5; margin-bottom: 12px;\\\"></div><div class=\\\"pricing\\\" style=\\\"margin-bottom: 12px;\\\"></div><div class=\\\"message\\\" style=\\\"color: #C12E6F; font-weight: 400; line-height: 1.5; text-align: left; margin-bottom: 12px;\\\"></div></div><div style=\\\"display: flex; flex-direction: column; gap: 8px;\\\"><div class=\\\"primary-action\\\"></div><div class=\\\"product-link\\\" style=\\\"display: flex; justify-content: center;\\\"></div></div>\";\n// Exports\nexport default code;","import type { CustomElement } from '@integrabeauty/custom-elements';\nimport html from './index.html';\nimport styles from './index.scss';\n\n/**\n * Renders product variant selector modal used by collection, slideshow and search results product\n * cards to allow customers to select variant options without navigation to the PDP.\n *\n * The modal shows and hides itself off `data-modal-state`. For now it sets that attribute itself\n * when it opens and closes. Later the modal manager sets it instead.\n */\nclass ProductVariantSelectorModal extends HTMLElement implements CustomElement {\n  public static get observedAttributes() {\n    return ['data-modal-state'];\n  }\n\n  declare readonly dataset: {\n    /**\n     * Currency ISO code. Required.\n     *\n     * @example \"US\"\n     */\n    currencyCode: string;\n\n    /**\n     * Currency Symbol. Required.\n     *\n     * @example \"$\"\n     */\n    currencySymbol: string;\n\n    /**\n     * Email of currently signed in customer.\n     */\n    customerEmail: string;\n\n    /**\n     * Feature flag to enable or disable discount modal, a string representing a boolean value. If\n     * the feature is enabled, we shouldn't show the discount message.\n     */\n    enableDiscountModal: 'false' | 'true';\n\n    /**\n     * Whether the modal is shown, as \"open\". Anything else, or no value at all, means closed.\n     */\n    modalState: string;\n  };\n\n  private declare product: Partial<Product>;\n  private declare selectedVariantId: number;\n  private declare country: string;\n  private selectedOptions: Record<string, string> = {};\n\n  private onSelectOptionRequestedBound = this.onSelectOptionRequested.bind(this);\n  private onProductVariantOptionChangedBound = this.onProductVariantOptionChanged.bind(this);\n  private onModalDismissRequestedBound = this.onModalDismissRequested.bind(this);\n  private onCartTransactionCompletedBound = this.onCartTransactionCompleted.bind(this);\n  private onNotifyMeClickedBound = this.onNotifyMeClicked.bind(this);\n  private onCompareAtPriceModalRequestedBound = this.onCompareAtPriceModalRequested.bind(this);\n  private onCloseButtonClickedBound = this.onCloseButtonClicked.bind(this);\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton?.addEventListener('click', this.onCloseButtonClickedBound);\n\n    addEventListener('select-option-requested', this.onSelectOptionRequestedBound);\n    addEventListener('modal-dismiss-requested', this.onModalDismissRequestedBound);\n    addEventListener('cart-transaction-completed', this.onCartTransactionCompletedBound);\n    addEventListener('notify-me-clicked', this.onNotifyMeClickedBound);\n    addEventListener('compare-at-price-modal-requested', this.onCompareAtPriceModalRequestedBound);\n    addEventListener('product-variant-option-changed', this.onProductVariantOptionChangedBound);\n  }\n\n  public disconnectedCallback() {\n    removeEventListener('select-option-requested', this.onSelectOptionRequestedBound);\n    removeEventListener('modal-dismiss-requested', this.onModalDismissRequestedBound);\n    removeEventListener('cart-transaction-completed', this.onCartTransactionCompletedBound);\n    removeEventListener('notify-me-clicked', this.onNotifyMeClickedBound);\n    removeEventListener('compare-at-price-modal-requested',\n      this.onCompareAtPriceModalRequestedBound);\n    removeEventListener('product-variant-option-changed', this.onProductVariantOptionChangedBound);\n\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton?.removeEventListener('click', this.onCloseButtonClickedBound);\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  public attributeChangedCallback(name: string, oldValue: string, newValue: string) {\n    this.initializeShadowRoot();\n\n    if (this.isConnected && name === 'data-modal-state' && oldValue !== newValue) {\n      if (newValue === 'open') {\n        this.show();\n      } else if (oldValue === 'open') {\n        this.hide();\n      }\n    }\n  }\n\n  private showModal() {\n    this.dataset.modalState = 'open';\n  }\n\n  private show() {\n    // Reveal the modal. The markup renders it with the hidden attribute so it stays hidden before\n    // this element upgrades.\n    this.hidden = false;\n\n    const event = new Event('modal-open-requested', { bubbles: true, composed: true });\n    this.dispatchEvent(event);\n  }\n\n  private closeModal() {\n    // Do nothing when already closed. The handlers that call this react to page-wide broadcasts\n    // heard by every modal, so without this guard a closed modal would tear down the shared\n    // backdrop out from under whichever modal is actually open.\n    if (this.hidden) {\n      return;\n    }\n\n    this.dataset.modalState = 'closed';\n  }\n\n  private hide() {\n    const event = new Event('modal-close-requested', { bubbles: true, composed: true });\n    this.dispatchEvent(event);\n\n    const productImageEl = this.shadowRoot.querySelector<HTMLImageElement>('img');\n    // set to a 1x1px gif to avoid flashing previous image when modal is opened again\n    productImageEl.src =\n      'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n\n    // Re-hide the modal via the global hidden attribute css rule.\n    this.hidden = true;\n  }\n\n  /**\n   * Close the modal when the backdrop has been clicked.\n   */\n  private onModalDismissRequested(_event: WindowEventMap['modal-dismiss-requested']) {\n    this.closeModal();\n  }\n\n  /**\n   * Close the modal when a cart transaction has completed (item added to cart).\n   */\n  private onCartTransactionCompleted(_event: WindowEventMap['cart-transaction-completed']) {\n    this.closeModal();\n  }\n\n  /**\n   * Close the modal when the notify me button on the product card has been clicked, making way for\n   * the notify me modal.\n   */\n  private onNotifyMeClicked(_event: WindowEventMap['notify-me-clicked']) {\n    this.closeModal();\n  }\n\n  /**\n   * Close the modal when the user clicked to view the compare at price modal on the product card,\n   * making way for it.\n   */\n  private onCompareAtPriceModalRequested(\n    _event: WindowEventMap['compare-at-price-modal-requested']) {\n    this.closeModal();\n  }\n\n  private onCloseButtonClicked(_event: MouseEvent) {\n    this.closeModal();\n  }\n\n  private onProductVariantOptionChanged(event: WindowEventMap['product-variant-option-changed']) {\n    // Option changes are broadcast page-wide by every variant picker. Re-render only when this\n    // modal is open, otherwise a closed modal would react to a selection made elsewhere on the\n    // page.\n    if (this.hidden) {\n      return;\n    }\n\n    for (const option of event.detail.option_groups || []) {\n      this.selectedOptions[option.name] = option.selected_option;\n    }\n\n    this.selectedVariantId = event.detail.selected_variant_id;\n\n    this.renderProductImage();\n    this.renderBackorderMessage();\n  }\n\n  private onSelectOptionRequested(event: WindowEventMap['select-option-requested']) {\n    // Careful with this assignment. These are two different product interface types that happen to\n    // be compatible because of careful design of the properties that happen to be in common. The\n    // type of event product is different than the type of the product property. This would be\n    // avoided if we used a shared type, but we cannot use a shared type because of the implicit\n    // rule that modules must be isolated and independent.\n    this.product = event.detail?.product;\n\n    this.selectedVariantId = this.product.selected_variant_id;\n    this.country = event.detail?.country;\n    this.selectedOptions = {};\n\n    for (const option of this.product.option_groups) {\n      this.selectedOptions[option.name] = option.selected_option;\n    }\n\n    this.render();\n    this.setOOSForSecondOptionGroup();\n    this.showModal();\n\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton.focus({ focusVisible: true });\n  }\n\n  private render() {\n    if (!this.product?.title) {\n      return;\n    }\n\n    this.renderTitle();\n    this.renderVariantOptions();\n    this.renderBackorderMessage();\n    this.renderProductImage();\n    this.renderPricing();\n    this.renderMessage();\n    this.renderPrimaryAction();\n    this.renderProductLink();\n  }\n\n  private renderProductImage() {\n    const productImageEl = this.shadowRoot.querySelector<HTMLImageElement>('img');\n\n    const selectedVariant = this.product.variants.find(\n      variant => variant.id === this.selectedVariantId);\n\n    if (selectedVariant) {\n      productImageEl.src = selectedVariant.image_src || this.product.main_image;\n    } else {\n      productImageEl.src = this.product.main_image;\n    }\n  }\n\n  private renderTitle() {\n    const titleEl = this.shadowRoot.querySelector<HTMLElement>('.title');\n    titleEl.innerText = this.product.title;\n\n    const subtitleEl = this.shadowRoot.querySelector<HTMLElement>('.subtitle');\n    subtitleEl.innerText = this.product.metafields_subtitle || '';\n\n    const ratingEl = this.shadowRoot.querySelector('product-rating-stars');\n    ratingEl.dataset.average = this.product.reviews_average?.toString() || '0';\n    ratingEl.dataset.count = this.product.reviews_count?.toString() || '0';\n  }\n\n  private renderPricing() {\n    const pricingEl = this.shadowRoot.querySelector('.pricing');\n    if (pricingEl) {\n      pricingEl.innerHTML = '';\n    }\n\n    const priceElement = document.createElement('product-price');\n    priceElement.dataset.currencyCode = this.dataset.currencyCode;\n    priceElement.dataset.currencySymbol = this.dataset.currencySymbol;\n\n    let selectedVariant = this.product.variants.find(variant =>\n      variant.id === this.product.selected_variant_id);\n\n    if (!selectedVariant) {\n      selectedVariant = this.product.variants[0];\n    }\n\n    if (!selectedVariant) {\n      return;\n    }\n\n    const productEl = document.createElement('product-element');\n    productEl.slot = 'product-price-data';\n    productEl.dataset.id = `${this.product.id}`;\n    productEl.dataset.type = this.product.type;\n    productEl.dataset.selectedVariantId = `${selectedVariant.id}`;\n\n    for (const variant of this.product.variants) {\n      const variantEl = document.createElement('variant-element');\n      variantEl.dataset.id = `${variant.id}`;\n      variantEl.dataset.price = `${variant.price}`;\n      variantEl.dataset.compareAtPrice = variant.compare_at_price ?\n        variant.compare_at_price.toString() : '';\n      variantEl.dataset.compareAtPriceModalContent =\n        variant.metafield_compare_at_price_modal_content || '';\n\n      productEl.appendChild(variantEl);\n    }\n\n    priceElement.appendChild(productEl);\n\n    pricingEl.appendChild(priceElement);\n  }\n\n  private renderBackorderMessage() {\n    if (!this.product) {\n      return;\n    }\n\n    const selectedVariant = this.product.variants.find(variant =>\n      variant.id === this.selectedVariantId);\n\n    const backorderMessage = this.shadowRoot.querySelector<HTMLElement>('.backorder');\n    if (selectedVariant?.backorder) {\n      backorderMessage.textContent = selectedVariant.backorder;\n      backorderMessage.hidden = false;\n    } else {\n      backorderMessage.textContent = '';\n      backorderMessage.hidden = true;\n    }\n  }\n\n  private renderMessage() {\n    const message = this.shadowRoot.querySelector<HTMLElement>('.message');\n    message.innerHTML = '';\n    message.hidden = true;\n\n    // If the discount modal feature is enabled, we do not render the discount message element.\n    if (this.dataset.enableDiscountModal === 'true') {\n      return;\n    }\n\n    // We apply the additional condition of discount percentage not equaling 0 to account for offer-\n    // 1 overrides using just the final sale price to drive discount messaging overrides.\n\n    if (!this.product.metafields_discount_code || (!this.product.metafields_discount_percentage &&\n      this.product.metafields_discount_percentage !== 0)) {\n      return;\n    }\n\n    const selectedVariant = this.product.variants.find(variant =>\n      variant.id === this.product.selected_variant_id);\n\n    // We are not guaranteed to find a selected variant due to misconfiguration. In this case we do\n    // not render the discount message element.\n\n    if (selectedVariant) {\n      const discountMessageElement = document.createElement('product-discount-message');\n      discountMessageElement.dataset.price = `${selectedVariant.price}`;\n      discountMessageElement.dataset.currencyCode = this.dataset.currencyCode;\n      discountMessageElement.dataset.currencySymbol = this.dataset.currencySymbol;\n      discountMessageElement.dataset.compareAtPrice = selectedVariant.compare_at_price ?\n        selectedVariant.compare_at_price.toString() : '';\n      discountMessageElement.dataset.discountCode = this.product.metafields_discount_code;\n      discountMessageElement.dataset.discountPercentage =\n        `${this.product.metafields_discount_percentage}`;\n\n      if (this.product.metafields_discount_override) {\n        discountMessageElement.dataset.messageOverride = this.product.metafields_discount_override;\n      }\n\n      message.innerHTML = '';\n      message.append(discountMessageElement);\n      message.hidden = false;\n    } else {\n      console.debug('Could not find selected variant when rendering discount text');\n    }\n  }\n\n  /**\n   * Builds one option group per entry on the product, which for an ordinary product means one group\n   * per choice the shopper makes about that product.\n   *\n   * A bundle works differently and is worth knowing about, because it is where the option groups\n   * stop lining up with anything a shopper would recognize as one product. Shopify represents a\n   * bundle as its own product whose variants are every combination of the bundled products'\n   * variants, so the groups here belong to several different products flattened into one list. The\n   * only thing marking which product a group came from is its name, which the Bundles app writes as\n   * the bundled product's title followed by the option name in parentheses. The product detail page\n   * avoids the flattened form entirely and renders a picker per bundled product instead, so this\n   * modal is the only place the flattened groups get shown as they are.\n   */\n  private renderVariantOptions() {\n    const variantOptionsContainer = this.shadowRoot.querySelector<HTMLElement>('.variant-options');\n    variantOptionsContainer.innerHTML = '';\n\n    const variantOptionsEl = document.createElement('variant-options');\n    variantOptionsEl.dataset.productId = this.product.id.toString();\n    variantOptionsEl.dataset.productTitle = this.product.title;\n    variantOptionsEl.dataset.productType = this.product.type;\n    variantOptionsEl.dataset.productUrl = this.product.url;\n    variantOptionsEl.dataset.selectedVariant = this.selectedVariantId.toString();\n    variantOptionsEl.dataset.discountCode = this.product.metafields_discount_code;\n\n    const variantOptionsSlotEl = document.createElement('div');\n    variantOptionsSlotEl.slot = 'groups';\n\n    for (const optionGroup of this.product.option_groups) {\n      const optionGroupEl = document.createElement('variant-option-group');\n      optionGroupEl.dataset.productId = this.product.id.toString();\n      optionGroupEl.dataset.name = optionGroup.name;\n      optionGroupEl.dataset.selectedValue = optionGroup.selected_option;\n      optionGroupEl.dataset.position = optionGroup.position.toString();\n      if (optionGroup.use_swatches_for_color !== undefined) {\n        optionGroupEl.dataset.useSwatchesForColor = optionGroup.use_swatches_for_color;\n      }\n\n      if (optionGroup.name === 'Size') {\n        for (const option of optionGroup.options) {\n          for (const variant of option.variants) {\n            if (variant.id === this.selectedVariantId && variant.sizeDescription) {\n              optionGroupEl.dataset.selectedDescription = variant.sizeDescription;\n            }\n          }\n        }\n      }\n\n      this.selectedOptions[optionGroup.name] = optionGroup.selected_option;\n\n      const variantOptionsGroupSlot = document.createElement('div');\n      variantOptionsGroupSlot.slot = 'options';\n\n      let count = 1;\n      for (const option of optionGroup.options) {\n        const optionName = toCSSClassName(optionGroup.name.toLowerCase());\n        const optionId = `${this.product.id}${optionName}${count}`;\n        const optionEl = document.createElement('div');\n        optionEl.dataset.value = option.value;\n\n        const inputEl = document.createElement('input');\n        inputEl.type = 'radio';\n        inputEl.name = `${this.product.id}${optionName}`;\n        inputEl.id = optionId;\n        inputEl.value = option.value;\n\n        if (optionGroup.selected_option === option.value) {\n          inputEl.checked = true;\n        }\n\n        if (optionGroup.name === 'Size') {\n          const variant = option.variants.find(variant => {\n            return variant.option1 === option.value || variant.option2 === option.value;\n          });\n          inputEl.dataset.description = variant?.sizeDescription ?? '';\n        }\n\n        const labelEl = document.createElement('label');\n        labelEl.classList.add(optionName);\n\n        if (optionGroup.use_swatches_for_color === 'true' && option.color) {\n          labelEl.style.backgroundColor = option.color;\n        }\n\n        if (isOutOfStock(option)) {\n          labelEl.classList.add('out-of-stock');\n        }\n\n        labelEl.htmlFor = optionId;\n        labelEl.appendChild(inputEl);\n        labelEl.appendChild(document.createTextNode(option.value));\n\n        optionEl.appendChild(labelEl);\n\n        variantOptionsGroupSlot.appendChild(optionEl);\n\n        count++;\n      }\n\n      optionGroupEl.appendChild(variantOptionsGroupSlot);\n      variantOptionsSlotEl.appendChild(optionGroupEl);\n    }\n\n    variantOptionsEl.appendChild(variantOptionsSlotEl);\n\n    for (const variant of this.product.variants) {\n      const div = document.createElement('variant-element');\n      div.dataset.available = variant.available.toString();\n      div.dataset.compareAtPrice = variant.compare_at_price?.toString();\n      div.dataset.price = variant.price.toString();\n      div.dataset.sku = variant.sku;\n      div.dataset.title = variant.title;\n      div.dataset.id = variant.id.toString();\n      div.dataset.option1 = variant.option1;\n      div.dataset.option2 = variant.option2;\n      div.dataset.option3 = variant.option3;\n\n      variantOptionsEl.appendChild(div);\n    }\n\n    variantOptionsContainer.appendChild(variantOptionsEl);\n\n    if (this.product.option_groups.length > 0) {\n      variantOptionsContainer.hidden = false;\n    } else {\n      variantOptionsContainer.hidden = true;\n    }\n  }\n\n  private renderPrimaryAction() {\n    let selectedVariant = this.product.variants.find(variant =>\n      variant.id === this.product.selected_variant_id);\n\n    if (!selectedVariant) {\n      selectedVariant = this.product.variants[0];\n    }\n\n    if (!selectedVariant) {\n      return;\n    }\n\n    const addToCart = document.createElement('add-to-cart');\n    addToCart.dataset.country = this.country;\n    addToCart.dataset.productListingDisplay = 'true';\n    addToCart.dataset.hideBackorderMessage = 'true';\n    addToCart.dataset.backorder = selectedVariant.backorder;\n    addToCart.dataset.discountCode = this.product.metafields_discount_code;\n    if (this.dataset.customerEmail) {\n      addToCart.dataset.customerEmail = this.dataset.customerEmail;\n    }\n\n    const product = document.createElement('product-element');\n    product.slot = 'product';\n    product.dataset.id = `${this.product.id}`;\n    product.dataset.available = `${this.product.available}`;\n    product.dataset.url = this.product.url;\n    product.dataset.title = this.product.title;\n    product.dataset.type = this.product.type;\n    product.dataset.selectedVariantId = `${selectedVariant.id}`;\n    product.dataset.tags = this.product.tags || '';\n\n    for (const variant of this.product.variants) {\n      const variantElement = document.createElement('variant-element');\n      variantElement.dataset.id = `${variant.id}`;\n      variantElement.dataset.available = `${variant.available}`;\n      variantElement.dataset.sku = variant.sku;\n      variantElement.dataset.title = variant.title;\n\n      if (variant.backorder) {\n        variantElement.dataset.backorder = variant.backorder;\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = '_backorder_message';\n        customAttribute.dataset.value = variant.backorder;\n        variantElement.appendChild(customAttribute);\n\n        if (variant.hide_backorder_in_collection) {\n          variantElement.dataset.hideBackorderInCollection = variant.hide_backorder_in_collection;\n        }\n      }\n\n      if (Number.isInteger(variant.backorder_selling_plan_id)) {\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = 'selling_plan';\n        customAttribute.dataset.value = variant.backorder_selling_plan_id.toString();\n        variantElement.appendChild(customAttribute);\n      }\n\n      // It is possible that this.product.tags is undefined\n      const tags = this.product.tags || '';\n\n      if (tags.includes('Contains Alcohol')) {\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = '_contains_alcohol';\n        customAttribute.dataset.value = 'true';\n        variantElement.appendChild(customAttribute);\n      }\n\n      if (tags.includes('compatibility-soleil')) {\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = '_compatibility';\n        customAttribute.dataset.value = 'soleil';\n        variantElement.appendChild(customAttribute);\n      }\n\n      if (tags.includes('compatibility-max-high-volume')) {\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = '_compatibility';\n        customAttribute.dataset.value = 'max-high-volume';\n        variantElement.appendChild(customAttribute);\n      }\n\n      if (tags.includes('final-sale')) {\n        const customAttribute = document.createElement('custom-attribute');\n        customAttribute.dataset.key = '_final_sale';\n        customAttribute.dataset.value = 'true';\n        variantElement.appendChild(customAttribute);\n\n        // signals to our returns vendor Loop that this line item is final sale and not eligible for\n        // return, mirroring add-to-cart.liquid\n        const loopAttribute = document.createElement('custom-attribute');\n        loopAttribute.dataset.key = '_LPROP';\n        loopAttribute.dataset.value = 'final-sale';\n        variantElement.appendChild(loopAttribute);\n      }\n\n      product.appendChild(variantElement);\n    }\n\n    addToCart.appendChild(product);\n\n    addToCart.dataset.full = 'true';\n\n    const primaryActionEl = this.shadowRoot.querySelector('.primary-action');\n    primaryActionEl.innerHTML = '';\n    primaryActionEl.appendChild(addToCart);\n  }\n\n  private renderProductLink() {\n    const productLinkEl = this.shadowRoot.querySelector('.product-link');\n    productLinkEl.innerHTML = '';\n    const anchor = document.createElement('a');\n    anchor.href = this.product.url;\n    anchor.innerText = 'View Details';\n    productLinkEl.appendChild(anchor);\n  }\n\n  /**\n   * Utility method to update variant options out-of-stock status when the product has 2 or more\n   * option groups, there can be a case when for the selected option1 variant for some option2 is\n   * not available. We need to mark them as OOS. E.g. there are 2 option groups: Color (with options\n   * \"Blush\" and \"Black\") and Size (with options \"25mm\" and \"75mm\"). For the option \"Blush\" there is\n   * no available variant. So when the user select \"Blush\" all Size options will be marked as OOS.\n   *\n   * This method should only be called after initialization of modal after the select-option-\n   * requested event is emitted and is no longer required to be called on every option change.\n   *\n   * By the time this runs, the render pass has already struck out every option that is unavailable\n   * across the whole product. So all this adds is the second group's availability relative to the\n   * option picked in the first group. Nothing here touches a third group.\n   *\n   * The equivalent pass for later option changes lives in the shared variant-options element rather\n   * than here, which is why this one only runs at open. See issue 6803.\n   */\n  private setOOSForSecondOptionGroup() {\n    if (!this.product || this.product.option_groups.length < 2) {\n      return;\n    }\n\n    const mainOptionName = this.product.option_groups[0].name;\n    const mainOptionValue = this.selectedOptions[mainOptionName];\n\n    // Each pass through the loop overwrites whatever the previous one wrote for the same label, so\n    // the last variant visited decides how the option looks. That works while exactly one variant\n    // matches each value in the second group, which holds for a product with two option groups.\n    // With three, several variants share a second group value and differ only in the third, so\n    // which one wins comes down to the order the variants arrive in.\n    const variants = this.product.variants\n      .filter(variant => variant.option1 === mainOptionValue);\n    for (const variant of variants) {\n      const option2 = variant.option2;\n      const label = this.shadowRoot.querySelector(\n        `variant-option-group[data-position=\"2\"] [data-value=\"${option2}\"] label`);\n\n      if (!label) {\n        continue;\n      }\n\n      if (variant.available) {\n        label.classList.remove('out-of-stock');\n      } else {\n        label.classList.add('out-of-stock');\n      }\n    }\n  }\n}\n\n/**\n * Whether an option is unavailable no matter what else is picked, meaning no variant carrying it is\n * available. This is the blanket check the render pass uses, so it knows nothing about the current\n * selection and cannot say that an option is unavailable only in combination with another one.\n */\nfunction isOutOfStock(option: ProductVariantOption) {\n  return option.variants.every(variant => !variant.available);\n}\n\nfunction toCSSClassName(value: string) {\n  return value.replace(/\\W/g, '-');\n}\n\ninterface ProductVariantOption {\n  value: string;\n  variants: Partial<{\n    /**\n     * Whether the variant has inventory in stock and is available for sale.\n     */\n    available: boolean;\n\n    backorder_message: string;\n\n    /**\n     * The \"Pre-Order\" deferred payment selling plan ID associated with a backordered variant.\n     */\n    backorder_selling_plan_id: number;\n\n    compare_at_price: number | null;\n\n    customAttributes: {\n      /**\n       * Key or name of the attribute.\n       */\n      key: string;\n\n      /**\n       * Value of the attribute.\n       */\n      value: string;\n    }[];\n\n    hideBackorderInCollection: string;\n\n    /**\n     * Variant id\n     */\n    id: number;\n\n    price: number;\n\n    sku: string;\n\n    title: string;\n  }>[];\n}\n\ninterface Product {\n  /**\n   * Product inventory availability\n   */\n  available: boolean;\n\n  /**\n   * Product award image\n   */\n  award_badge_image: string;\n\n  /**\n   * Product award tag\n   */\n  award_tag: string;\n\n  /**\n   * Product badge type\n   */\n  badge_type: '' | 'best-seller' | 'favorite' | 'new' | 'travel-friendly';\n\n  /**\n   * Bundles created using the Shopify app use an abstraction product created by the application to\n   * represent the bundle. If a product's variant options are being presented in the context of a\n   * product in a bundle this attribute identifies the product ID for the abstraction product\n   * created by the Shopify Bundle App to represent that bundle.\n   */\n  bundle_product_id: number;\n\n  /**\n   * Shopify product id\n   */\n  id: number;\n\n  /**\n   * Product main image loading method\n   */\n  lazyload: boolean;\n\n  /**\n   * Product main image\n   */\n  main_image: string;\n\n  /**\n   * Product metafields discount code (used to promote public discount codes)\n   */\n  metafields_discount_code: string;\n\n  /**\n   * Product metafields discount override to use one-off messages instead of generated text\n   */\n  metafields_discount_override: string;\n\n  /**\n   * Product metafields discount percentage (used to render public discount code prices)\n   */\n  metafields_discount_percentage: number;\n\n  /**\n   * Product metafields subtitle\n   */\n  metafields_subtitle: string;\n\n  /**\n   * Product metafields title\n   */\n  metafields_title: string;\n\n  option_groups: {\n    name: string;\n    options: {\n      color?: string;\n      value: string;\n      variants: Partial<{\n        /**\n         * Whether the variant has inventory in stock and is available for sale.\n         */\n        available: boolean;\n\n        backorder_message: string;\n\n        compare_at_price: number | null;\n\n        customAttributes: {\n          /**\n           * Key or name of the attribute.\n           */\n          key: string;\n\n          /**\n           * Value of the attribute.\n           */\n          value: string;\n        }[];\n\n        hideBackorderInCollection: string;\n\n        /**\n         * Variant id\n         */\n        id: number;\n\n        /**\n         * The value of the variant for the first product option. If there's no first product\n         * option, then nil is returned.\n         */\n        option1: string;\n\n        /**\n         * The value of the variant for the second product option. If there's no second product\n         * option, then nil is returned.\n         */\n        option2: string;\n\n        /**\n         * The value of the variant for the third product option. If there's no third product\n         * option, then nil is returned.\n         */\n        option3: string;\n\n        price: number;\n\n        /**\n         * The short description associated with the variant size option.\n         */\n        sizeDescription: string;\n\n        sku: string;\n\n        title: string;\n      }>[];\n    }[];\n    position?: number;\n    selected_option: string;\n    use_swatches_for_color?: 'false' | 'true';\n  }[];\n\n  /**\n   * Product yotpo reviews average value\n   */\n  reviews_average: number;\n\n  /**\n   * Product yotpo reviews count\n   */\n  reviews_count: number;\n\n  /**\n   * Selected variant id\n   */\n  selected_variant_id: number;\n\n  /**\n   * Product sku\n   */\n  sku: string;\n\n  /**\n   * Product tags\n   */\n  tags: string;\n\n  /**\n   * Product title\n   */\n  title: string;\n\n  /**\n   * Product type\n   *\n   * @example \"hair-care\"\n   */\n  type: string;\n\n  /**\n   * Shopify product url\n   */\n  url: string;\n\n  /**\n   * A list of the product's variants with some information about variant\n   */\n  variants: {\n    /**\n     * Whether the variant is in stock\n     */\n    available: boolean;\n\n    /**\n     * Whether the variant is on backorder\n     */\n    backorder: string;\n\n    /**\n     * The \"Pre-Order\" deferred payment selling plan ID associated with a backordered variant.\n     */\n    backorder_selling_plan_id: number;\n\n    /**\n     * The MSRP, or original sales price before discounts, per unit\n     */\n    compare_at_price: number | null;\n\n    /**\n     * The currency code associated with the price\n     */\n    currency_code: string;\n\n    /**\n     * Boolean as a string to indicate whether to hide any backorder message if the product card is\n     * being viewed in a collection context.\n     */\n    hide_backorder_in_collection: string;\n\n    /**\n     * Variant id\n     *\n     * @example 12345568943\n     */\n    id: number;\n\n    /**\n     * URL of the image associated with the variant. Only populated by some dispatchers (e.g. the\n     * product card), so it is optional on this shared event contract.\n     */\n    image_src?: string;\n\n    /**\n     * Content to be displayed in the compare at price modal for a particular variant. Only\n     * populated by some dispatchers (e.g. the product card), so it is optional on this shared event\n     * contract.\n     */\n    metafield_compare_at_price_modal_content?: string;\n\n    /**\n     * The value of the variant for the first product option. If there's no first product option,\n     * then nil is returned.\n     */\n    option1: string;\n\n    /**\n     * The value of the variant for the second product option. If there's no second product option,\n     * then nil is returned.\n     */\n    option2: string;\n\n    /**\n     * The value of the variant for the third product option. If there's no third product option,\n     * then nil is returned.\n     */\n    option3: string;\n\n    /**\n     * The price of the variant in the currency's subunit.\n     *\n     * @see https://shopify.dev/docs/api/liquid/objects/variant#variant-price\n     */\n    price: number;\n\n    /**\n     * Whether this variant is the currently selected variant out of all the variants for the\n     * product\n     */\n    selected: boolean;\n\n    /**\n     * The Stock Keeping Unit associated with the variant. This is another kind of product id.\n     */\n    sku: string;\n\n    /**\n     * The title of the variant.\n     */\n    title: string;\n  }[];\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'product-variant-selector-modal': ProductVariantSelectorModal;\n  }\n}\n\nif (!customElements.get('product-variant-selector-modal')) {\n  customElements.define('product-variant-selector-modal', ProductVariantSelectorModal);\n}\n"],"names":["__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","b","document","baseURI","self","location","href","product_variant_selector_modal","URL","ProductVariantSelectorModal","HTMLElement","observedAttributes","selectedOptions","onSelectOptionRequestedBound","this","onSelectOptionRequested","bind","onProductVariantOptionChangedBound","onProductVariantOptionChanged","onModalDismissRequestedBound","onModalDismissRequested","onCartTransactionCompletedBound","onCartTransactionCompleted","onNotifyMeClickedBound","onNotifyMeClicked","onCompareAtPriceModalRequestedBound","onCompareAtPriceModalRequested","onCloseButtonClickedBound","onCloseButtonClicked","connectedCallback","initializeShadowRoot","closeButton","shadowRoot","querySelector","addEventListener","disconnectedCallback","removeEventListener","attachShadow","mode","innerHTML","attributeChangedCallback","name","oldValue","newValue","isConnected","show","hide","showModal","dataset","modalState","hidden","event","Event","bubbles","composed","dispatchEvent","closeModal","src","_event","option","detail","option_groups","selected_option","selectedVariantId","selected_variant_id","renderProductImage","renderBackorderMessage","_event$detail","_event$detail2","product","country","render","setOOSForSecondOptionGroup","focus","focusVisible","_this$product","title","renderTitle","renderVariantOptions","renderPricing","renderMessage","renderPrimaryAction","renderProductLink","productImageEl","selectedVariant","variants","find","variant","id","image_src","main_image","_this$product$reviews","_this$product$reviews2","innerText","metafields_subtitle","ratingEl","average","reviews_average","toString","count","reviews_count","pricingEl","priceElement","createElement","currencyCode","currencySymbol","productEl","slot","type","variantEl","price","compareAtPrice","compare_at_price","compareAtPriceModalContent","metafield_compare_at_price_modal_content","appendChild","backorderMessage","backorder","textContent","message","enableDiscountModal","metafields_discount_code","metafields_discount_percentage","discountMessageElement","discountCode","discountPercentage","metafields_discount_override","messageOverride","append","console","debug","variantOptionsContainer","variantOptionsEl","productId","productTitle","productType","productUrl","url","variantOptionsSlotEl","optionGroup","optionGroupEl","selectedValue","position","use_swatches_for_color","useSwatchesForColor","options","sizeDescription","selectedDescription","variantOptionsGroupSlot","optionName","toCSSClassName","toLowerCase","optionId","optionEl","value","inputEl","checked","_variant$sizeDescript","option1","option2","description","labelEl","classList","add","color","style","backgroundColor","isOutOfStock","htmlFor","createTextNode","_variant$compare_at_p","div","available","sku","option3","length","addToCart","productListingDisplay","hideBackorderMessage","customerEmail","tags","variantElement","customAttribute","key","hide_backorder_in_collection","hideBackorderInCollection","Number","isInteger","backorder_selling_plan_id","includes","loopAttribute","full","primaryActionEl","productLinkEl","anchor","mainOptionName","mainOptionValue","filter","label","remove","every","replace","customElements","get","define"],"sourceRoot":""}