{
  "version": 3,
  "sources": ["/cdn/shop/t/11/assets/za-product.js?cb=1791074635323"],
  "sourcesContent": ["/**\n * Z\u00FChre Ana - product page behaviour: pack selector + order help.\n * Vanilla JS (ES5), no dependencies. Loaded with defer by sections/main-product.liquid.\n *\n * How the pack cards talk to the Kalles theme (assets/swatch.min.js):\n * - The theme binds a delegated click on \".swatches-select > .nt-swatch\" inside the product form.\n *   That handler picks the variant, writes it to select[name=\"id\"] and runs the theme's\n *   selectCallback(), which updates price, add to cart, buy now, sticky bar, gallery image and URL,\n *   then fires jQuery_T4NT(document).trigger('variant:change', variant).\n * - The theme's swatches stay in the DOM (visually hidden in .za-pack-native). Choosing a card\n *   simply clicks the matching swatch, so the theme does all the work with its own code.\n * - The checked card follows the theme through the 'variant:change' event and, as a safety net,\n *   a MutationObserver on the swatch list (covers changes started by the gallery or before\n *   jQuery is available).\n * - The theme script is lazy loaded. If a card is chosen before it starts, the choice is stored on\n *   the swatch with the class the theme clicks on start-up (.is-selected-nt) and written to\n *   select[name=\"id\"], so the right pack is added to the cart either way.\n * - If anything here fails, html.za-no-pack hides the cards and shows the theme's swatches again.\n */\n(function () {\n  'use strict';\n\n  var doc = document;\n  var root = doc.documentElement;\n\n  if (window.zaProduct) {\n    window.zaProduct.init(doc);\n    return;\n  }\n\n  function toArray(list) {\n    return Array.prototype.slice.call(list || []);\n  }\n\n  function closest(node, selector) {\n    if (node.closest) {\n      return node.closest(selector);\n    }\n    var matches = node.matches || node.msMatchesSelector || node.webkitMatchesSelector;\n    while (node && node.nodeType === 1) {\n      if (matches.call(node, selector)) {\n        return node;\n      }\n      node = node.parentNode;\n    }\n    return null;\n  }\n\n  /* ------------------------------------------------------------------\n     Pack selector\n     ------------------------------------------------------------------ */\n\n  function initPack(pack) {\n    if (pack.zaPackReady) {\n      return;\n    }\n\n    var form = closest(pack, 'form');\n    var select = form ? form.querySelector('select[name=\"id\"]') : null;\n    var native = form ? form.querySelector('.za-pack-native') : null;\n    var list = native ? native.querySelector('.swatches-select') : null;\n    var inputs = toArray(pack.querySelectorAll('.za-pack__input'));\n\n    if (!select || !list || !inputs.length) {\n      throw new Error('za-pack: theme variant markup not found');\n    }\n\n    var swatches = toArray(list.children);\n\n    // One card <-> one native swatch, matched on the raw option value.\n    var pairs = inputs.map(function (input) {\n      var value = input.getAttribute('data-value');\n      var match = null;\n      swatches.forEach(function (swatch) {\n        if (swatch.getAttribute('data-escape') === value) {\n          match = swatch;\n        }\n      });\n      if (!match) {\n        throw new Error('za-pack: no theme swatch for \"' + value + '\"');\n      }\n      return { input: input, swatch: match };\n    });\n\n    function swatchFor(input) {\n      for (var i = 0; i < pairs.length; i++) {\n        if (pairs[i].input === input) {\n          return pairs[i].swatch;\n        }\n      }\n      return null;\n    }\n\n    function currentSwatch() {\n      return list.querySelector('.nt-swatch.is-selected') || list.querySelector('.nt-swatch.is-selected-nt');\n    }\n\n    // Theme -> cards.\n    function syncFromTheme() {\n      var current = currentSwatch();\n      if (!current) {\n        return;\n      }\n      pairs.forEach(function (pair) {\n        if (pair.swatch === current && !pair.input.checked) {\n          pair.input.checked = true;\n        }\n      });\n    }\n\n    // Cards -> theme.\n    function choose(input) {\n      var swatch = swatchFor(input);\n      if (!swatch) {\n        return;\n      }\n      if (!swatch.classList.contains('is-selected')) {\n        if (!list.querySelector('.is-selected')) {\n          // Theme script not started yet (or nothing picked so far): mark this swatch the way\n          // the theme expects its start-up selection, so it begins from the chosen pack.\n          toArray(list.querySelectorAll('.is-selected-nt')).forEach(function (item) {\n            item.classList.remove('is-selected-nt');\n          });\n          swatch.classList.add('is-selected-nt');\n        }\n        swatch.click();\n      }\n      // Safety net: if the theme did not handle the click, still post the chosen pack.\n      if (select.value !== input.value) {\n        select.value = input.value;\n      }\n    }\n\n    pack.addEventListener('change', function (event) {\n      var input = event.target;\n      if (input && input.checked && swatchFor(input)) {\n        choose(input);\n      }\n    });\n\n    if ('MutationObserver' in window) {\n      new MutationObserver(syncFromTheme).observe(list, {\n        attributes: true,\n        attributeFilter: ['class'],\n        subtree: true\n      });\n    }\n\n    // A card tapped before this script was ready wins; otherwise follow the theme's state.\n    var early = pack.querySelector('.za-pack__input:checked:not(:disabled)');\n    if (early && swatchFor(early) !== currentSwatch()) {\n      choose(early);\n    } else {\n      syncFromTheme();\n    }\n\n    // The cards now speak for the hidden swatches.\n    native.setAttribute('aria-hidden', 'true');\n    pack.zaPackReady = true;\n  }\n\n  // Theme hook: fired by swatch.min.js at the end of every variant change.\n  function onThemeVariantChange(event, variant) {\n    if (!variant || !variant.id) {\n      return;\n    }\n    var id = String(variant.id);\n    toArray(doc.querySelectorAll('.za-pack__input')).forEach(function (input) {\n      if (input.value === id && !input.checked) {\n        input.checked = true;\n      }\n    });\n  }\n\n  function bindThemeEvent(attempt) {\n    var $ = window.jQuery_T4NT;\n    if ($ && $.fn && typeof $.fn.on === 'function') {\n      $(doc).off('variant:change.zaPack').on('variant:change.zaPack', onThemeVariantChange);\n      return;\n    }\n    if (attempt < 40) {\n      window.setTimeout(function () {\n        bindThemeEvent(attempt + 1);\n      }, 250);\n    }\n  }\n\n  /* ------------------------------------------------------------------\n     Order help: add the chosen pack and quantity to the WhatsApp message\n     ------------------------------------------------------------------ */\n\n  function initWhatsApp(link) {\n    if (link.zaReady) {\n      return;\n    }\n    var base = link.getAttribute('data-za-base');\n    var text = link.getAttribute('data-za-text');\n    var url = link.getAttribute('data-za-url') || '';\n    if (!base || !text) {\n      return;\n    }\n    link.zaReady = true;\n\n    function refresh() {\n      var scope = closest(link, '.btn-atc') || doc;\n      var message = text;\n      var target = url;\n      var packOn = !root.classList.contains('za-no-pack');\n      var picked = packOn ? scope.querySelector('.za-pack__input:checked') : null;\n      var qtyInput = scope.querySelector('.quantity input.qty');\n      var qty = qtyInput ? parseInt(qtyInput.value, 10) : 1;\n\n      if (picked) {\n        message += ' \u2013 ' + picked.getAttribute('data-label');\n        if (target) {\n          target += (target.indexOf('?') === -1 ? '?' : '&') + 'variant=' + picked.value;\n        }\n      }\n      if (qty > 1) {\n        message += ', cantitate: ' + qty;\n      }\n      link.href = base + '?text=' + encodeURIComponent(message + (target ? '\\n' + target : ''));\n    }\n\n    // Refreshed just before the link is followed (tap, click, keyboard, long press).\n    ['pointerdown', 'focus', 'click'].forEach(function (type) {\n      link.addEventListener(type, refresh);\n    });\n  }\n\n  /* ------------------------------------------------------------------\n     Start\n     ------------------------------------------------------------------ */\n\n  function init(scope) {\n    scope = scope && scope.querySelectorAll ? scope : doc;\n\n    var packs = toArray(scope.querySelectorAll('[data-za-pack]'));\n    packs.forEach(function (pack) {\n      try {\n        initPack(pack);\n      } catch (error) {\n        root.classList.add('za-no-pack');\n      }\n    });\n    if (packs.length) {\n      bindThemeEvent(0);\n    }\n\n    toArray(scope.querySelectorAll('[data-za-wa]')).forEach(initWhatsApp);\n  }\n\n  window.zaProduct = { init: init };\n\n  init(doc);\n\n  // Theme editor: the section is re-rendered in place.\n  doc.addEventListener('shopify:section:load', function (event) {\n    init(event.target);\n  });\n})();\n"],
  "mappings": "CAmBC,UAAY,CACX,aAEA,IAAI,IAAM,SACN,KAAO,IAAI,gBAEf,GAAI,OAAO,UAAW,CACpB,OAAO,UAAU,KAAK,GAAG,EACzB,MACF,CAEA,SAAS,QAAQ,KAAM,CACrB,OAAO,MAAM,UAAU,MAAM,KAAK,MAAQ,CAAC,CAAC,CAC9C,CAEA,SAAS,QAAQ,KAAM,SAAU,CAC/B,GAAI,KAAK,QACP,OAAO,KAAK,QAAQ,QAAQ,EAG9B,QADI,QAAU,KAAK,SAAW,KAAK,mBAAqB,KAAK,sBACtD,MAAQ,KAAK,WAAa,GAAG,CAClC,GAAI,QAAQ,KAAK,KAAM,QAAQ,EAC7B,OAAO,KAET,KAAO,KAAK,UACd,CACA,OAAO,IACT,CAMA,SAAS,SAAS,KAAM,CACtB,GAAI,KAAK,YACP,OAGF,IAAI,KAAO,QAAQ,KAAM,MAAM,EAC3B,OAAS,KAAO,KAAK,cAAc,mBAAmB,EAAI,KAC1D,OAAS,KA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