{
  "version": 3,
  "sources": ["/cdn/shop/t/83/assets/laley-page-hero.js?lly=laley-custom-20260908-illustrations-v848"],
  "sourcesContent": ["(() => {\n  const timers = new WeakMap();\n  const signupForms = new WeakSet();\n\n  function initSignup(root) {\n    const form = root.querySelector('[data-hero-signup-form]');\n    if (!form || signupForms.has(form)) return;\n    signupForms.add(form);\n\n    const emailInput = form.querySelector('[data-hero-signup-email]');\n    const trigger = form.querySelector('[data-hero-email-continue]');\n    const error = root.querySelector('[data-hero-signup-error]');\n\n    form.addEventListener('submit', (event) => {\n      event.preventDefault();\n      if (error) error.textContent = '';\n\n      const email = (emailInput?.value || '').trim();\n      if (!emailInput || !emailInput.checkValidity()) {\n        if (error) error.textContent = 'Skriv inn en gyldig e-postadresse.';\n        emailInput?.focus();\n        return;\n      }\n\n      let attempts = 0;\n      const continueInSidebar = () => {\n        const popup = document.querySelector('[data-kk-popup]');\n        if (!popup || typeof popup.open !== 'function') {\n          attempts += 1;\n          if (attempts < 20) {\n            window.setTimeout(continueInSidebar, 50);\n          } else if (error) {\n            error.textContent = 'Pr\u00F8v igjen om et \u00F8yeblikk.';\n          }\n          return;\n        }\n\n        if (typeof popup.beginEmailSignup === 'function') {\n          const started = popup.beginEmailSignup(email, trigger);\n          if (started === false) {\n            if (error) error.textContent = 'Pr\u00F8v igjen om et \u00F8yeblikk.';\n            return;\n          }\n\n          // Keep the e-mail through the immediate sidebar view transition.\n          // The phone step stays visually focused without repeating the\n          // e-mail field, while the final Klaviyo request retains identity.\n          const preserveSidebarEmail = () => {\n            const activePopup = document.querySelector('[data-kk-popup]');\n            const sidebarEmail = activePopup?.emailInput || activePopup?.querySelector('input[name=\"email\"]');\n            if (!sidebarEmail || !activePopup.classList.contains('is-open')) return;\n            sidebarEmail.value = email;\n            sidebarEmail.dispatchEvent(new Event('input', { bubbles: true }));\n          };\n\n          window.requestAnimationFrame(preserveSidebarEmail);\n          window.setTimeout(preserveSidebarEmail, 100);\n          window.setTimeout(preserveSidebarEmail, 300);\n          return;\n        }\n\n        if (typeof popup.applyTriggerContent === 'function') popup.applyTriggerContent(trigger);\n        popup.open(true, 'sidebar');\n        if (typeof popup.setSidebarSignupMethod === 'function') popup.setSidebarSignupMethod('email', false);\n\n        const prefillSidebarEmail = () => {\n          const sidebarEmail = popup.emailInput || popup.querySelector('input[name=\"email\"]');\n          if (!sidebarEmail) return;\n          sidebarEmail.value = email;\n          sidebarEmail.dispatchEvent(new Event('input', { bubbles: true }));\n        };\n\n        prefillSidebarEmail();\n        if (typeof popup.goStep2 === 'function') popup.goStep2();\n\n        // The Kundeklubb custom element can finish its own opening cycle just\n        // after `open()`. Reapply the value after that cycle so step 2 never\n        // loses the e-mail supplied by the campaign hero.\n        window.requestAnimationFrame(prefillSidebarEmail);\n        window.setTimeout(prefillSidebarEmail, 100);\n      };\n\n      continueInSidebar();\n    });\n\n    emailInput?.addEventListener('input', () => {\n      if (error) error.textContent = '';\n    });\n  }\n\n  function stop(root) {\n    const timer = timers.get(root);\n    if (timer) window.clearInterval(timer);\n    timers.delete(root);\n  }\n\n  function init(root) {\n    stop(root);\n    initSignup(root);\n\n    const owner = root.closest('.shopify-section') || root.parentElement;\n    const wrap = owner?.querySelector('[data-countdown-wrap]');\n    const countdown = wrap?.querySelector('[data-countdown-target]');\n    if (!countdown) return;\n\n    const targetTime = new Date(countdown.dataset.countdownTarget || '').getTime();\n    if (!Number.isFinite(targetTime)) {\n      wrap.hidden = true;\n      return;\n    }\n\n    const values = {\n      days: countdown.querySelector('[data-days]'),\n      hours: countdown.querySelector('[data-hours]'),\n      minutes: countdown.querySelector('[data-minutes]'),\n      seconds: countdown.querySelector('[data-seconds]'),\n    };\n\n    const update = () => {\n      const distance = targetTime - Date.now();\n      if (distance <= 0) {\n        stop(root);\n        wrap.innerHTML = '<span class=\"hero-countdown-bar-label hero-countdown-bar-label--launched\">N\u00C5 LANSERT!</span>';\n        return;\n      }\n\n      const remaining = {\n        days: Math.floor(distance / 86400000),\n        hours: Math.floor((distance % 86400000) / 3600000),\n        minutes: Math.floor((distance % 3600000) / 60000),\n        seconds: Math.floor((distance % 60000) / 1000),\n      };\n\n      Object.entries(values).forEach(([key, node]) => {\n        if (node) node.textContent = String(remaining[key]).padStart(2, '0');\n      });\n    };\n\n    update();\n    if (!wrap.isConnected || !countdown.isConnected) return;\n    timers.set(root, window.setInterval(update, 1000));\n  }\n\n  function initAll(scope = document) {\n    if (scope.matches?.('.index-hero')) init(scope);\n    scope.querySelectorAll?.('.index-hero').forEach(init);\n  }\n\n  initAll();\n  document.addEventListener('shopify:section:load', (event) => initAll(event.target));\n  document.addEventListener('shopify:section:unload', (event) => {\n    event.target.querySelectorAll?.('.index-hero').forEach(stop);\n  });\n})();\n"],
  "mappings": "CAAC,IAAM,CACL,MAAM,OAAS,IAAI,QACb,YAAc,IAAI,QAExB,SAAS,WAAW,KAAM,CACxB,MAAM,KAAO,KAAK,cAAc,yBAAyB,EACzD,GAAI,CAAC,MAAQ,YAAY,IAAI,IAAI,EAAG,OACpC,YAAY,IAAI,IAAI,EAEpB,MAAM,WAAa,KAAK,cAAc,0BAA0B,EAC1D,QAAU,KAAK,cAAc,4BAA4B,EACzD,MAAQ,KAAK,cAAc,0BAA0B,EAE3D,KAAK,iBAAiB,SAAW,OAAU,CACzC,MAAM,eAAe,EACjB,QAAO,MAAM,YAAc,IAE/B,MAAM,OAAS,YAAY,OAAS,IAAI,KAAK,EAC7C,GAAI,CAAC,YAAc,CAAC,WAAW,cAAc,EAAG,CAC1C,QAAO,MAAM,YAAc,sCAC/B,YAAY,MAAM,EAClB,MACF,CAEA,IAAI,SAAW,EACf,MAAM,kBAAoB,IAAM,CAC9B,MAAM,MAAQ,SAAS,cAAc,iBAAiB,EACtD,GAAI,CAAC,OAAS,OAAO,MAAM,MAAS,WAAY,CAC9C,UAAY,EACR,SAAW,GACb,OAAO,WAAW,kBAAmB,EAAE,EAC9B,QACT,MAAM,YAAc,oCAEtB,MACF,CAEA,GAAI,OAAO,MAAM,kBAAqB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