{
  "version": 3,
  "sources": ["/cdn/shop/t/25/assets/component.js?everide_v=d30a6c8"],
  "sourcesContent": ["import { requestIdleCallback } from '@theme/utilities';\n\n/*\n * Declarative shadow DOM is only initialized on the initial render of the page.\n * If the component is mounted after the browser finishes the initial render,\n * the shadow root needs to be manually hydrated.\n */\nexport class DeclarativeShadowElement extends HTMLElement {\n  connectedCallback() {\n    if (!this.shadowRoot) {\n      const template = this.querySelector(':scope > template[shadowrootmode=\"open\"]');\n\n      if (!(template instanceof HTMLTemplateElement)) return;\n\n      const shadow = this.attachShadow({ mode: 'open' });\n      shadow.append(template.content.cloneNode(true));\n    }\n  }\n}\n\n/**\n * @typedef {Record<string, Element | Element[] | undefined>} Refs\n */\n\n/**\n * @template {Refs} T\n * @typedef {T & Refs} RefsType\n */\n\n/**\n * Base class that powers our custom web components.\n *\n * Manages references to child elements with `ref` attributes and sets up mutation observers to keep\n * the refs updated when the DOM changes. Also handles declarative event listeners using.\n *\n * @template {Refs} [T=Refs]\n * @extends {DeclarativeShadowElement}\n */\nexport class Component extends DeclarativeShadowElement {\n  /**\n   * An object holding references to child elements with `ref` attributes.\n   *\n   * @type {RefsType<T>}\n   */\n  refs = /** @type {RefsType<T>} */ ({});\n\n  /**\n   * An array of required refs. If a ref is not found, an error will be thrown.\n   *\n   * @type {string[] | undefined}\n   */\n  requiredRefs;\n\n  /**\n   * Gets the root node of the component, which is either its shadow root or the component itself.\n   *\n   * @returns {(ShadowRoot | Component<T>)[]} The root nodes.\n   */\n  get roots() {\n    return this.shadowRoot ? [this, this.shadowRoot] : [this];\n  }\n\n  /**\n   * Called when the element is connected to the document's DOM.\n   *\n   * Initializes event listeners and refs.\n   */\n  connectedCallback() {\n    super.connectedCallback();\n    registerEventListeners();\n\n    this.#updateRefs();\n\n    requestIdleCallback(() => {\n      for (const root of this.roots) {\n        this.#mutationObserver.observe(root, {\n          childList: true,\n          subtree: true,\n          attributes: true,\n          attributeFilter: ['ref'],\n          attributeOldValue: true,\n        });\n      }\n    });\n  }\n\n  /**\n   * Called when the Section Rendering API re-renders this element and morph detects a change in\n   * its subtree. morph skips subtrees it finds unchanged (oldNode.isEqualNode(newNode)), so this\n   * does not fire when a re-render leaves this component's own subtree identical.\n   */\n  updatedCallback() {\n    this.#mutationObserver.takeRecords();\n    this.#updateRefs();\n  }\n\n  /**\n   * Called when the element is disconnected from the document's DOM.\n   *\n   * Disconnects the mutation observer.\n   */\n  disconnectedCallback() {\n    this.#mutationObserver.disconnect();\n  }\n\n  /**\n   * Updates the `refs` object by querying all descendant elements with `ref` attributes and storing references to them.\n   *\n   * This method is called to keep the `refs` object in sync with the DOM.\n   */\n  #updateRefs() {\n    const refs = /** @type any */ ({});\n    const elements = this.roots.reduce((acc, root) => {\n      for (const element of root.querySelectorAll('[ref]')) {\n        if (!this.#isDescendant(element)) continue;\n        acc.add(element);\n      }\n\n      return acc;\n    }, /** @type {Set<Element>} */ (new Set()));\n\n    for (const ref of elements) {\n      const refName = ref.getAttribute('ref') ?? '';\n      const isArray = refName.endsWith('[]');\n      const path = isArray ? refName.slice(0, -2) : refName;\n\n      if (isArray) {\n        const array = Array.isArray(refs[path]) ? refs[path] : [];\n\n        array.push(ref);\n        refs[path] = array;\n      } else {\n        refs[path] = ref;\n      }\n    }\n\n    if (this.requiredRefs?.length) {\n      for (const ref of this.requiredRefs) {\n        if (!(ref in refs)) {\n          throw new MissingRefError(ref, this);\n        }\n      }\n    }\n\n    this.refs = /** @type {RefsType<T>} */ (refs);\n  }\n\n  /**\n   * MutationObserver instance to observe changes in the component's DOM subtree and update refs accordingly.\n   *\n   * @type {MutationObserver}\n   */\n  #mutationObserver = new MutationObserver((mutations) => {\n    if (\n      mutations.some(\n        (m) =>\n          (m.type === 'attributes' && this.#isDescendant(m.target)) ||\n          (m.type === 'childList' && [...m.addedNodes, ...m.removedNodes].some(this.#isDescendant))\n      )\n    ) {\n      this.#updateRefs();\n    }\n  });\n\n  /**\n   * Checks if a given node is a descendant of this component.\n   *\n   * @param {Node} node - The node to check.\n   * @returns {boolean} True if the node is a descendant of this component.\n   */\n  #isDescendant = (node) => getClosestComponent(getAncestor(node)) === this;\n}\n\n/**\n * Get the ancestor of a given node.\n *\n * @param {Node} node - The node to get the ancestor of.\n * @returns {Node | null} The ancestor of the node or null if none is found.\n */\nfunction getAncestor(node) {\n  if (node.parentNode) return node.parentNode;\n\n  const root = node.getRootNode();\n  if (root instanceof ShadowRoot) return root.host;\n\n  return null;\n}\n\n/**\n * Recursively finds the closest ancestor that is an instance of `Component`.\n *\n * @param {Node | null} node - The starting node to search from.\n * @returns {HTMLElement | null} The closest ancestor `Component` instance or null if none is found.\n */\nfunction getClosestComponent(node) {\n  if (!node) return null;\n  if (node instanceof Component) return node;\n  if (node instanceof HTMLElement && node.tagName.toLowerCase().endsWith('-component')) return node;\n\n  const ancestor = getAncestor(node);\n  if (ancestor) return getClosestComponent(ancestor);\n\n  return null;\n}\n\n/**\n * Initializes the event listeners for custom event handling.\n *\n * Sets up event listeners for specified events and delegates the handling of those events\n * to methods defined on the closest `Component` instance, based on custom attributes.\n */\nlet initialized = false;\n\nfunction registerEventListeners() {\n  if (initialized) return;\n  initialized = true;\n\n  const events = [\n    'click',\n    'change',\n    'select',\n    'focus',\n    'blur',\n    'submit',\n    'input',\n    'keydown',\n    'keyup',\n    'toggle',\n    // `pointerdown` bubbles, so a press landing on a descendant of the\n    // `on:pointerdown` element still resolves to it via `closest()`.\n    'pointerdown',\n  ];\n  const shouldBubble = ['focus', 'blur'];\n  const expensiveEvents = ['pointerenter', 'pointerleave'];\n\n  for (const eventName of [...events, ...expensiveEvents]) {\n    const attribute = `on:${eventName}`;\n\n    document.addEventListener(\n      eventName,\n      (event) => {\n        const element = getElement(event);\n\n        if (!element) return;\n\n        const proxiedEvent =\n          event.target !== element\n            ? new Proxy(event, {\n                get(target, property) {\n                  if (property === 'target') return element;\n\n                  const value = Reflect.get(target, property);\n\n                  if (typeof value === 'function') {\n                    return value.bind(target);\n                  }\n\n                  return value;\n                },\n              })\n            : event;\n\n        const value = element.getAttribute(attribute) ?? '';\n        let [selector, method] = value.split('/');\n        // Extract the last segment of the attribute value delimited by `?` or `/`\n        // Do not use lookback for Safari 16.0 compatibility\n        const matches = value.match(/([\\/\\?][^\\/\\?]+)([\\/\\?][^\\/\\?]+)$/);\n        const data = matches ? matches[2] : null;\n        const instance = selector\n          ? selector.startsWith('#')\n            ? document.querySelector(selector)\n            : element.closest(selector)\n          : getClosestComponent(element);\n\n        if (!method) return;\n\n        // Close the custom-element upgrade race: the resolved instance may be a\n        // `<foo-component>` element that's already in the DOM but whose JS module\n        // hasn't yet executed connectedCallback as a `Component` subclass. Without\n        // this, the click/change/etc. is silently dropped because\n        // `instance instanceof Component` returns false. `customElements.upgrade`\n        // is synchronous, idempotent, and a no-op if the element is already\n        // upgraded or its class isn't registered yet.\n        if (\n          !(instance instanceof Component) &&\n          instance instanceof HTMLElement &&\n          instance.tagName.toLowerCase().endsWith('-component')\n        ) {\n          customElements.upgrade(instance);\n\n          if (!(instance instanceof Component)) {\n            // Surface the drop instead of swallowing it. This typically means the\n            // module defining `<{tagName}>` hasn't yet been parsed/executed \u2014\n            // a real bug for users on slow connections, and the silent failure\n            // mode that has caused the bulk of recent Playwright flakes.\n            console.warn(\n              `[component] Dropped \"${event.type}\" on <${instance.tagName.toLowerCase()}> \u2014 element not yet upgraded`\n            );\n            return;\n          }\n        }\n\n        if (!instance) return;\n\n        method = method.replace(/\\?.*/, '');\n\n        const callback = /** @type {any} */ (instance)[method];\n\n        if (!(instance instanceof Component) && typeof callback !== 'function') return;\n\n        if (typeof callback === 'function') {\n          try {\n            /** @type {(Event | Data)[]} */\n            const args = [proxiedEvent];\n\n            if (data) args.unshift(parseData(data));\n\n            callback.call(instance, ...args);\n          } catch (error) {\n            console.error(error);\n          }\n        }\n      },\n      { capture: true }\n    );\n  }\n\n  /** @param {Event} event */\n  function getElement(event) {\n    const target = event.composedPath?.()[0] ?? event.target;\n\n    if (!(target instanceof Element)) return;\n\n    if (target.hasAttribute(`on:${event.type}`)) {\n      return target;\n    }\n\n    if (expensiveEvents.includes(event.type)) {\n      return null;\n    }\n\n    return event.bubbles || shouldBubble.includes(event.type) ? target.closest(`[on\\\\:${event.type}]`) : null;\n  }\n}\n\n/**\n * Parses a string to extract data based on a delimiter.\n *\n * @param {string} str - The string to parse.\n * @returns {Object|Array<string|number>|string} The parsed data.\n */\nfunction parseData(str) {\n  const delimiter = str[0];\n  const data = str.slice(1);\n\n  return delimiter === '?'\n    ? Object.fromEntries(\n        Array.from(new URLSearchParams(data).entries()).map(([key, value]) => [key, parseValue(value)])\n      )\n    : parseValue(data);\n}\n\n/**\n * @typedef {Object|Array<string|number>|string} Data\n */\n\n/**\n * Parses a string value to its appropriate type.\n *\n * @param {string} str - The string to parse.\n * @returns {Data} The parsed value.\n */\nfunction parseValue(str) {\n  if (str === 'true') return true;\n  if (str === 'false') return false;\n\n  const maybeNumber = Number(str);\n  if (!isNaN(maybeNumber) && str.trim() !== '') return maybeNumber;\n\n  return str;\n}\n\n/**\n * Throws a formatted error when a required ref is not found in the component.\n */\nclass MissingRefError extends Error {\n  /**\n   * @param {string} ref\n   * @param {Component} component\n   */\n  constructor(ref, component) {\n    super(`Required ref \"${ref}\" not found in component ${component.tagName.toLowerCase()}`);\n  }\n}\n"],
  "mappings": "AAAA,OAAS,wBAA2B,mBAO7B,aAAM,iCAAiC,WAAY,CACxD,mBAAoB,CAClB,GAAI,CAAC,KAAK,WAAY,CACpB,MAAM,SAAW,KAAK,cAAc,0CAA0C,EAE9E,GAAI,EAAE,oBAAoB,qBAAsB,OAEjC,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EAC1C,OAAO,SAAS,QAAQ,UAAU,EAAI,CAAC,CAChD,CACF,CACF,CAoBO,aAAM,kBAAkB,wBAAyB,CAMtD,KAAmC,CAAC,EAOpC,aAOA,IAAI,OAAQ,CACV,OAAO,KAAK,WAAa,CAAC,KAAM,KAAK,UAAU,EAAI,CAAC,IAAI,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