{
  "version": 3,
  "sources": ["/cdn/shop/t/35/assets/custom.js?x=1792505676798"],
  "sourcesContent": ["/**\n * DEVELOPER DOCUMENTATION\n *\n * Include your custom JavaScript here.\n *\n * The theme Focal has been developed to be easily extensible through the usage of a lot of different JavaScript\n * events, as well as the usage of custom elements (https://developers.google.com/web/fundamentals/web-components/customelements)\n * to easily extend the theme and re-use the theme infrastructure for your own code.\n *\n * The technical documentation is summarized here.\n *\n * ------------------------------------------------------------------------------------------------------------\n * BEING NOTIFIED WHEN A VARIANT HAS CHANGED\n * ------------------------------------------------------------------------------------------------------------\n *\n * This event is fired whenever a the user has changed the variant in a selector. The target get you the form\n * that triggered this event.\n *\n * Example:\n *\n * document.addEventListener('variant:changed', function(event) {\n *   let variant = event.detail.variant; // Gives you access to the whole variant details\n *   let form = event.target;\n * });\n *\n * ------------------------------------------------------------------------------------------------------------\n * MANUALLY CHANGE A VARIANT\n * ------------------------------------------------------------------------------------------------------------\n *\n * You may want to manually change the variant, and let the theme automatically adjust all the selectors. To do\n * that, you can get the DOM element of type \"<product-variants>\", and call the selectVariant method on it with\n * the variant ID.\n *\n * Example:\n *\n * const productVariantElement = document.querySelector('product-variants');\n * productVariantElement.selectVariant(12345);\n *\n * ------------------------------------------------------------------------------------------------------------\n * BEING NOTIFIED WHEN A NEW VARIANT IS ADDED TO THE CART\n * ------------------------------------------------------------------------------------------------------------\n *\n * This event is fired whenever a variant is added to the cart through a form selector (product page, quick\n * view...). This event DOES NOT include any change done through the cart on an existing variant. For that,\n * please refer to the \"cart:updated\" event.\n *\n * Example:\n *\n * document.addEventListener('variant:added', function(event) {\n *   var variant = event.detail.variant; // Get the variant that was added\n * });\n *\n * ------------------------------------------------------------------------------------------------------------\n * BEING NOTIFIED WHEN THE CART CONTENT HAS CHANGED\n * ------------------------------------------------------------------------------------------------------------\n *\n * This event is fired whenever the cart content has changed (if the quantity of a variant has changed, if a variant\n * has been removed, if the note has changed...). This event will also be emitted when a new variant has been\n * added (so you will receive both \"variant:added\" and \"cart:updated\"). Contrary to the variant:added event,\n * this event will give you the complete details of the cart.\n *\n * Example:\n *\n * document.addEventListener('cart:updated', function(event) {\n *   var cart = event.detail.cart; // Get the updated content of the cart\n * });\n *\n * ------------------------------------------------------------------------------------------------------------\n * REFRESH THE CART/MINI-CART\n * ------------------------------------------------------------------------------------------------------------\n *\n * If you are adding variants to the cart and would like to instruct the theme to re-render the cart, you cart\n * send the cart:refresh event, as shown below:\n *\n * document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {\n *   bubbles: true\n * }));\n *\n * ------------------------------------------------------------------------------------------------------------\n * USAGE OF CUSTOM ELEMENTS\n * ------------------------------------------------------------------------------------------------------------\n *\n * Our theme makes extensive use of HTML custom elements. Custom elements are an awesome way to extend HTML\n * by creating new elements that carry their own JavaScript for adding new behavior. The theme uses a large\n * number of custom elements, but the two most useful are drawer and popover. Each of those components add\n * a \"open\" attribute that you can toggle on and off. For instance, let's say you would like to open the cart\n * drawer, whose id is \"mini-cart\", you simply need to retrieve it and set its \"open\" attribute to true (or\n * false to close it):\n *\n * document.getElementById('mini-cart').open = true;\n *\n * Thanks to the power of custom elements, the theme will take care automagically of trapping focus, maintaining\n * proper accessibility attributes...\n *\n * If you would like to create your own drawer, you can re-use the <drawer-content> content. Here is a simple\n * example:\n *\n * // Make sure you add \"aria-controls\", \"aria-expanded\" and \"is\" HTML attributes to your button:\n * <button type=\"button\" is=\"toggle-button\" aria-controls=\"id-of-drawer\" aria-expanded=\"false\">Open drawer</button>\n *\n * <drawer-content id=\"id-of-drawer\">\n *   Your content\n * </drawer-content>\n *\n * The nice thing with custom elements is that you do not actually need to instantiate JavaScript yourself: this\n * is done automatically as soon as the element is inserted to the DOM.\n *\n * ------------------------------------------------------------------------------------------------------------\n * THEME DEPENDENCIES\n * ------------------------------------------------------------------------------------------------------------\n *\n * While the theme tries to keep outside dependencies as small as possible, the theme still uses third-party code\n * to power some of its features. Here is the list of all dependencies:\n *\n * \"vendor.js\":\n *\n * The vendor.js contains required dependencies. This file is loaded in parallel of the theme file.\n *\n * - custom-elements polyfill (used for built-in elements on Safari - v1.0.0): https://github.com/ungap/custom-elements\n * - web-animations-polyfill (used for polyfilling WebAnimations on Safari 12, this polyfill will be removed in 1 year - v2.3.2): https://github.com/web-animations/web-animations-js\n * - instant-page (v5.1.0): https://github.com/instantpage/instant.page\n * - tocca (v2.0.9); https://github.com/GianlucaGuarini/Tocca.js/\n * - seamless-scroll-polyfill (v2.0.0): https://github.com/magic-akari/seamless-scroll-polyfill\n *\n * \"flickity.js\": v2.2.0 (with the \"fade\" package). Flickity is only loaded on demand if there is a product image\n * carousel on the page. Otherwise it is not loaded.\n *\n * \"photoswipe\": v4.1.3. PhotoSwipe is only loaded on demand to power the zoom feature on product page. If the zoom\n * feature is disabled, then this script is never loaded.\n */\n\n/**\n * ====================================================================================================\n * GIFT WITH PURCHASE - Auto add/remove gift when subtotal reaches \u00E2\u201A\u00B91999\n * Note: Shopify automatic discounts don't appear in cart.js API, so we rely on threshold check\n * The gift is added when cart subtotal >= \u00E2\u201A\u00B91,999 (matching the discount condition)\n * ====================================================================================================\n */\n//gift item addition code start\n(function() {\n  const GIFT_VARIANT_ID = 46909443244195;\n  const THRESHOLD_CENTS = 199900; // \u00E2\u201A\u00B91999\n  const GIFT_FEATURE_ENABLED = true;\n  if (!GIFT_FEATURE_ENABLED || window.__svGiftInit) return;\n  window.__svGiftInit = true;\n\n  // Keep an unwrapped fetch so our own gift calls never re-trigger the check (no loops).\n  const rawFetch = window.fetch.bind(window);\n  const CART_WRITE = /\\/cart\\/(add|change|update|clear)(\\.js)?(\\?|$)/;\n  let running = false, rerun = false;\n\n  async function checkAndUpdateGift() {\n    if (running) { rerun = true; return; }\n    running = true;\n    try {\n      do {\n        rerun = false;\n        const cart = await (await rawFetch('/cart.js', { cache: 'no-store' })).json();\n        const giftIdx = cart.items.findIndex(i => i.variant_id === GIFT_VARIANT_ID);\n        const giftItem = giftIdx !== -1 ? cart.items[giftIdx] : null;\n        const others = cart.items.filter(i => i.variant_id !== GIFT_VARIANT_ID);\n        const subtotal = others.reduce((s, i) => s + i.final_line_price, 0);\n        const shouldHave = others.length > 0 && subtotal >= THRESHOLD_CENTS;\n        let changed = false;\n        if (shouldHave && !giftItem) {\n          const r = await rawFetch('/cart/add.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: [{ id: GIFT_VARIANT_ID, quantity: 1 }] }) });\n          changed = r.ok;\n        } else if (giftItem && (!shouldHave || giftItem.quantity !== 1)) {\n          const r = await rawFetch('/cart/change.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ line: giftIdx + 1, quantity: shouldHave ? 1 : 0 }) });\n          changed = r.ok;\n        }\n        if (changed && !rerun) {\n          // One re-render of the drawer / cart sections. Pre-fetch fresh drawer HTML and apply it after\n          // Focal's own (possibly delayed, stale) replacement so the gift line isn't overwritten.\n          let detail = { replacementDelay: 700 };\n          try {\n            const html = await (await rawFetch('/cart?section_id=mini-cart', { cache: 'no-store' })).text();\n            if (html.indexOf('cart-drawer') !== -1) detail.cart = { item_count: others.length ? 1 : 0, sections: { 'mini-cart': html } };\n          } catch (e) {}\n          document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', { bubbles: true, detail }));\n        }\n      } while (rerun);\n    } catch (e) {\n      console.error('Gift with purchase error:', e);\n    } finally {\n      running = false;\n    }\n  }\n\n  // Run immediately after any cart write made by the theme or apps\n  window.fetch = function(input, init) {\n    const url = typeof input === 'string' ? input : (input && input.url) || '';\n    const p = rawFetch(input, init);\n    if (CART_WRITE.test(url)) p.then(r => { if (r.ok) checkAndUpdateGift(); }).catch(() => {});\n    return p;\n  };\n  // Fallbacks for Focal events\n  document.addEventListener('variant:added', checkAndUpdateGift);\n\n  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', checkAndUpdateGift);\n  else checkAndUpdateGift();\n})();\n\n//gift item addition code end\n"],
  "mappings": "CA2IC,UAAW,CAIV,GAA6B,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