{"version":3,"file":"foldHomePage-BJjTYN8o.js","sources":["../../../app/javascript/modules/foldHomePage.js"],"sourcesContent":["import Flickity from \"flickity\";\nimport { on } from \"../utils/listeners\";\nimport api from \"../api\";\n\nconst foldHomePage = () => {\n  on(\"click\", \".js-fold-load-more\", (el, e) => {\n    e.preventDefault();\n    api\n      .get(el.href)\n      .then(response => {\n        document.querySelector(\".js-fold-load-more-container\").remove();\n        document\n          .querySelector(\"#fold-articles-container\")\n          .insertAdjacentHTML(\"beforeend\", response.data);\n      })\n      .catch(error => {\n        console.log(error);\n      });\n  });\n\n  on(\"click\", \".fold-homepage-scroller\", () => {\n    document.querySelector(\"#scroll-to-target\").scrollIntoView({\n      behavior: \"smooth\"\n    });\n  });\n\n  // Product page thumbnail images\n  const carousels = document.querySelectorAll(\".fold-carousel\");\n  const options = {\n    pageDots: true,\n    prevNextButtons: true,\n    imagesLoaded: true,\n    arrowShape:\n      \"M2.896 52.164A4.716 4.716 0 0 1 .6 48a4.716 4.716 0 0 1 2.292-4.164l41.82-42.464a4.572 4.572 0 0 1 6.536 0c1.8 1.832 1.8 4.804 0 6.636L11.86 48l39.388 39.992c1.8 1.832 1.8 4.8 0 6.636a4.572 4.572 0 0 1-6.536 0L2.896 52.16v.004z\",\n\n    // These events work around ios 11.3+ bug\n    // https://github.com/metafizzy/flickity/issues/740\n    on: {\n      dragStart: () => {\n        document.ontouchmove = e => {\n          e.preventDefault();\n        };\n      },\n      dragEnd: () => {\n        document.ontouchmove = () => true;\n      }\n    }\n  };\n\n  if (carousels.length) {\n    carousels.forEach(carousel => {\n      // annoyingly we have to use the new syntax but don't need the variable.\n      // eslint-disable-next-line no-unused-vars\n      const flkty = new Flickity(carousel, options);\n    });\n  }\n};\n\nexport default foldHomePage;\n"],"names":["foldHomePage","on","el","e","api","response","error","carousels","options","carousel","Flickity"],"mappings":"mKAIK,MAACA,EAAe,IAAM,CACzBC,EAAG,QAAS,qBAAsB,CAACC,EAAIC,IAAM,CAC3CA,EAAE,eAAgB,EAClBC,EACG,IAAIF,EAAG,IAAI,EACX,KAAKG,GAAY,CAChB,SAAS,cAAc,8BAA8B,EAAE,OAAQ,EAC/D,SACG,cAAc,0BAA0B,EACxC,mBAAmB,YAAaA,EAAS,IAAI,CACjD,CAAA,EACA,MAAMC,GAAS,CACd,QAAQ,IAAIA,CAAK,CACzB,CAAO,CACP,CAAG,EAEDL,EAAG,QAAS,0BAA2B,IAAM,CAC3C,SAAS,cAAc,mBAAmB,EAAE,eAAe,CACzD,SAAU,QAChB,CAAK,CACL,CAAG,EAGD,MAAMM,EAAY,SAAS,iBAAiB,gBAAgB,EACtDC,EAAU,CACd,SAAU,GACV,gBAAiB,GACjB,aAAc,GACd,WACE,sOAIF,GAAI,CACF,UAAW,IAAM,CACf,SAAS,YAAc,GAAK,CAC1B,EAAE,eAAgB,CACnB,CACF,EACD,QAAS,IAAM,CACb,SAAS,YAAc,IAAM,EACrC,CACA,CACG,EAEGD,EAAU,QACZA,EAAU,QAAQE,GAAY,CAGd,IAAIC,EAASD,EAAUD,CAAO,CAClD,CAAK,CAEL"}