{
  "version": 3,
  "sources": ["/cdn/shop/t/125/assets/ch-surface-coordinator.js?chv=2"],
  "sourcesContent": ["(() => {\n  const selectors = {\n    cartDialog: 'cart-drawer-component .cart-drawer__dialog',\n    cartNotification: 'ch-cart-success-notification',\n    cartRewardNotification: 'ch-cart-reward-notification',\n    chat: '#chatbot-root .ch-v2',\n    chatClose: '#chatbot-root .ch-v2-overlay',\n    menu: '#Details-menu-drawer-container',\n  };\n\n  const closeChat = () => {\n    const chat = document.querySelector(selectors.chat);\n    if (chat?.getAttribute('data-open') !== 'true') return;\n\n    const closeButton = document.querySelector(selectors.chatClose);\n    if (closeButton instanceof HTMLButtonElement) closeButton.click();\n  };\n\n  const closeMenu = () => {\n    const drawer = document.querySelector('header-drawer');\n    if (!drawer?.querySelector(`${selectors.menu}[open]`)) return;\n\n    if (typeof drawer.close === 'function') {\n      drawer.close();\n      return;\n    }\n\n    customElements.whenDefined('header-drawer').then(() => {\n      if (drawer.querySelector(`${selectors.menu}[open]`) && typeof drawer.close === 'function') drawer.close();\n    });\n  };\n\n  const closeCart = () => {\n    const drawer = document.querySelector('cart-drawer-component');\n    if (!drawer?.querySelector('.cart-drawer__dialog[open]')) return;\n\n    if (typeof drawer.close === 'function') {\n      drawer.close();\n      return;\n    }\n\n    customElements.whenDefined('cart-drawer-component').then(() => {\n      if (drawer.querySelector('.cart-drawer__dialog[open]') && typeof drawer.close === 'function') drawer.close();\n    });\n  };\n\n  const closeCartNotification = () => {\n    const notification = document.querySelector(`${selectors.cartNotification}[open]`);\n    if (!(notification instanceof HTMLElement)) return;\n\n    const closeButton = notification.querySelector('[data-ch-cart-success-close]');\n    if (closeButton instanceof HTMLButtonElement) closeButton.click();\n  };\n\n  const closeCartRewardNotification = () => {\n    const notification = document.querySelector(`${selectors.cartRewardNotification}[open]`);\n    if (!(notification instanceof HTMLElement)) return;\n\n    const closeButton = notification.querySelector('[data-ch-reward-close]');\n    if (closeButton instanceof HTMLButtonElement) closeButton.click();\n  };\n\n  const syncClosedChatLauncher = () => {\n    const hasOpenThemeSurface = Boolean(\n      document.querySelector(\n        `${selectors.menu}[open], ${selectors.cartDialog}[open], ${selectors.cartNotification}[open], ${selectors.cartRewardNotification}[open], dialog[open]`\n      )\n    );\n\n    document.documentElement.toggleAttribute('data-ch-chat-launcher-hidden', hasOpenThemeSurface);\n  };\n\n  const handleOpenedSurface = (surface) => {\n    if (surface === 'chat') {\n      closeMenu();\n      closeCart();\n      closeCartNotification();\n      closeCartRewardNotification();\n      return;\n    }\n\n    closeChat();\n\n    if (surface === 'menu') {\n      closeCart();\n      closeCartNotification();\n      closeCartRewardNotification();\n    } else if (surface === 'cart') {\n      closeMenu();\n      closeCartNotification();\n      closeCartRewardNotification();\n    } else if (surface === 'cart-notification') {\n      closeMenu();\n      closeCart();\n      closeCartRewardNotification();\n    } else if (surface === 'cart-reward-notification') {\n      closeMenu();\n      closeCart();\n      closeCartNotification();\n    }\n  };\n\n  const observer = new MutationObserver((mutations) => {\n    for (const mutation of mutations) {\n      const target = mutation.target;\n      if (!(target instanceof Element)) continue;\n\n      if (mutation.attributeName === 'data-open' && target.matches(selectors.chat)) {\n        if (target.getAttribute('data-open') === 'true') handleOpenedSurface('chat');\n        continue;\n      }\n\n      if (mutation.attributeName !== 'open' || !target.hasAttribute('open')) continue;\n\n      if (target.matches(selectors.menu)) {\n        handleOpenedSurface('menu');\n      } else if (target.matches(selectors.cartDialog)) {\n        handleOpenedSurface('cart');\n      } else if (target.matches(selectors.cartNotification)) {\n        handleOpenedSurface('cart-notification');\n      } else if (target.matches(selectors.cartRewardNotification)) {\n        handleOpenedSurface('cart-reward-notification');\n      } else if (target.matches('dialog')) {\n        closeChat();\n      }\n    }\n\n    syncClosedChatLauncher();\n  });\n\n  observer.observe(document.documentElement, {\n    attributes: true,\n    attributeFilter: ['data-open', 'open'],\n    subtree: true,\n  });\n\n  syncClosedChatLauncher();\n})();\n"],
  "mappings": "CAAC,IAAM,CACL,MAAM,UAAY,CAChB,WAAY,6CAC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