{
  "version": 3,
  "sources": ["/cdn/shop/t/87/assets/hk-card-titles.js?r=step5"],
  "sourcesContent": ["/* ------------------------------------------------------------------\n   Hanakini card titles (TEST, Oct 2026)\n\n   Why: product card titles came from the titles typed into B4B\n   (\"Waioka Cover Up - North Shore - Linen Blend\"), which have to be\n   kept up to date by hand.\n\n   What this does on collection pages:\n   - Line 1: the product's title from Shopify (\"Waioka Cover Up\").\n   - Line 2: the colorway that card shows (\"North Shore\"), taken from\n     the same color B4B uses for the card (or the card's linked variant).\n   - Uses the product data already inside each card, so there is nothing\n     to download and the new titles appear the instant a card is drawn.\n   - New products and colorways label themselves; nothing to type in B4B.\n   - B4B cards, plain cards and restored cards all get the same format.\n   - If a card has no product data, its title is left exactly as it was.\n   Product pages are not affected.\n   Deleting the one script line in snippets/shop-your-size-styles.liquid\n   turns it off completely.\n------------------------------------------------------------------- */\n(function () {\n  if (window.__hkCardTitles) return;\n  window.__hkCardTitles = true;\n\n  if (!/\\/collections\\/[^\\/?#]+/.test(window.location.pathname) || window.location.pathname.indexOf(\"/products/\") > -1) return;\n\n  var style = document.createElement(\"style\");\n  style.textContent = \".hk-card-color{color:#7a6e6e;margin-top:2px}\";\n  document.head.appendChild(style);\n\n  function niceColor(value) {\n    return String(value).toLowerCase().replace(/(^|[\\s\\-\\/(])([a-z])/g, function (m, a, b) { return a + b.toUpperCase(); });\n  }\n\n  // The card's own variant list (sizes, colors, names), same data the size bar uses\n  function variantsFor(card) {\n    var el = card.querySelector(\"script[data-selected-variant]\");\n    if (!el) return null;\n    var text = el.textContent;\n    if (card.__hkTitleSrc === text) return card.__hkTitleVariants;\n    var list = null;\n    try { list = JSON.parse(text); } catch (e) {}\n    card.__hkTitleSrc = text;\n    card.__hkTitleVariants = Array.isArray(list) && list.length ? list : null;\n    return card.__hkTitleVariants;\n  }\n\n  // \"Waioka Cover Up - ORCHID / XS\" minus \" - ORCHID / XS\" -> \"Waioka Cover Up\"\n  function productTitle(v) {\n    var name = String(v.name || \"\");\n    var tail = v.public_title ? \" - \" + v.public_title : \"\";\n    if (tail && name.slice(-tail.length) === tail) return name.slice(0, -tail.length);\n    return v.public_title ? null : name;\n  }\n\n  function apply(card) {\n    var titleEl = card.querySelector(\".grid-product__title\");\n    var link = card.querySelector('a[href*=\"/products/\"]');\n    if (!titleEl || !link) return;\n    var variants = variantsFor(card);\n    if (!variants) return;\n    var title = productTitle(variants[0]);\n    if (!title) return;\n\n    // Line 1: product title\n    if (titleEl.textContent.trim() !== title) titleEl.textContent = title;\n\n    // Line 2: colorway\n    var color = \"\";\n    var ci = parseInt(card.getAttribute(\"data-color-index\"), 10);\n    var b4bColor = card.getAttribute(\"data-b4b-color\");\n    if (b4bColor) {\n      color = b4bColor;\n    } else if (ci >= 0) {\n      var vid = ((link.getAttribute(\"href\") || \"\").match(/[?&]variant=(\\d+)/) || [])[1];\n      if (vid) {\n        for (var i = 0; i < variants.length; i++) {\n          if (String(variants[i].id) === vid) { color = (variants[i].options || [])[ci] || \"\"; break; }\n        }\n      }\n    }\n    if (color) color = niceColor(color);\n\n    var line = card.querySelector(\".hk-card-color\");\n    if (color) {\n      if (!line || line.previousElementSibling !== titleEl) {\n        if (line) line.remove();\n        line = document.createElement(\"div\");\n        line.className = \"hk-card-color\";\n        titleEl.insertAdjacentElement(\"afterend\", line);\n      }\n      if (line.textContent !== color) line.textContent = color;\n    } else if (line) {\n      line.remove();\n    }\n  }\n\n  function applyAll() {\n    document.querySelectorAll(\"#CollectionAjaxContent .grid-product\").forEach(apply);\n  }\n\n  // Runs right after B4B (or a filter) changes the grid, before the screen repaints\n  if (window.MutationObserver) {\n    new MutationObserver(applyAll).observe(document.documentElement, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: [\"data-b4b-color\", \"href\"] });\n  }\n  applyAll();\n})();\n"],
  "mappings": "CAoBC,UAAY,CAIX,GAHI,OAAO,iBACX,OAAO,eAAiB,GAEpB,CAAC,0BAA0B,KAAK,OAAO,SAAS,QAAQ,GAAK,OAAO,S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