{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/helpers/index.js","webpack://@verndale/toolkit/./src/js/modules/bicentennial/CrossLinkBlock.js"],"names":[],"mappings":"oRAIO,KAAM,GAAW,CAAC,EAAU,IAAS,CAC1C,GAAI,GACJ,MAAO,IAAI,IAAS,CAClB,aAAa,GACb,EAAU,WAAW,IAAM,CACzB,EAAS,GAAG,IACX,KAIM,EAAW,CAAC,EAAU,IAAS,CAC1C,GAAI,GACJ,MAAO,IAAI,IAAS,CAClB,GACE,GAAS,GAAG,GACZ,EAAa,GACb,WAAW,IAAM,CACf,EAAa,IACZ,MASI,EAAc,GAAM,CAC/B,GACE,EAAG,SAAW,GACb,EAAG,WAAa,GAAK,EAAG,aAAa,cAAgB,KAEtD,MAAO,GAGT,GAAI,EAAG,SACL,MAAO,GAIT,OAAQ,EAAG,cACJ,IACH,MAAO,CAAC,CAAC,EAAG,MAAQ,EAAG,MAAQ,aAC5B,QACH,MAAO,GAAG,OAAS,UAAY,EAAG,OAAS,WACxC,aACA,aACA,WACH,MAAO,WAEP,MAAO,KAQA,EAAU,CACrB,IAAK,EACL,OAAQ,GACR,IAAK,GACL,MAAO,GACP,OAAQ,GACR,SAAU,GACV,IAAK,GACL,KAAM,GACN,KAAM,GACN,GAAI,GACJ,MAAO,GACP,KAAM,IAMK,EAAc,CACzB,OAAQ,IACR,OAAQ,IACR,gBAAiB,KACjB,QAAS,KACT,KAAM,MAOK,EAA2B,CACtC,eAAgB,GAChB,WAAY,GACZ,OAAQ,GACR,cAAe,EACf,aAAc,EACd,MAAO,IACP,cAAe,GACf,oBAAqB,IAOV,EAAiB,GACxB,MAAO,IAAU,SACZ,EAAM,QAAQ,wBAAyB,CAAC,EAAG,IAChD,OAAO,aAAa,SAAS,EAAG,MAE7B,G,kEC5GT,SAAW,CAAC,KAAY,KAAY,OAEpC,eAA6B,KAAU,CACrC,eAAgB,CACd,KAAK,IAAM,CACT,gBAAiB,KAAK,GAAG,cACvB,qBAEF,aAAc,KAAK,GAAG,iBACpB,iBAEF,iBAAkB,KAAK,GAAG,cACxB,sBAEF,iBAAkB,KAAK,GAAG,cACxB,oBAEF,iBAAkB,KAAK,GAAG,cACxB,oBAEF,eAAgB,KAAK,GAAG,cACtB,qBAGJ,KAAK,aAGP,iBAAiB,EAAQ,CACvB,EAAW,SACT,KAAK,IAAI,eAAe,MAAM,QAAU,OAExC,KAAK,IAAI,eAAe,MAAM,eAAe,WAIjD,YAAa,CACX,KAAM,GAAc,KAAK,IAAI,aAAa,OACpC,EAAS,KAEf,KAAK,OAAS,GAAI,MAAO,KAAK,IAAI,gBAAiB,IAC9C,EACH,YAAa,EACV,aAAqB,CACpB,cAAe,EAAc,EAAI,EAAI,EACrC,eAAgB,EAAc,EAAI,EAAI,IAGvC,sBAA8B,CAC7B,cAAe,IAGnB,WAAY,CACV,OAAQ,KAAK,IAAI,iBACjB,OAAQ,KAAK,IAAI,kBAEnB,KAAM,CACJ,iBAAkB,KAAK,GAAG,QAAQ,uBAClC,iBAAkB,KAAK,GAAG,QAAQ,oBAEpC,WAAY,CACV,GAAI,KAAK,IAAI,iBACb,UAAW,IAEb,GAAI,CACF,KAAM,KAAK,iBAAiB,KAAK,MACjC,OAAQ,IAAM,SAAS,KAAK,iBAAiB,KAAK,MAAO,SAOjE,UAAe","file":"scripts/45.5d89b02ab3db8b2611ca.js","sourcesContent":["// /**\n// * debounce function\n// * Delays the processing of the event\n// */\nexport const debounce = (callback, wait) => {\n  let timerId;\n  return (...args) => {\n    clearTimeout(timerId);\n    timerId = setTimeout(() => {\n      callback(...args);\n    }, wait);\n  };\n};\n\nexport const throttle = (callback, wait) => {\n  let inThrottle;\n  return (...args) => {\n    if (!inThrottle) {\n      callback(...args);\n      inThrottle = true;\n      setTimeout(() => {\n        inThrottle = false;\n      }, wait);\n    }\n  };\n};\n// /**\n// * Checks if an element is focusable\n// *\n// * @param {Object} el - HTML element you want to check if it's focusable\n// */\nexport const isFocusable = el => {\n  if (\n    el.tabIndex > 0 ||\n    (el.tabIndex === 0 && el.getAttribute('tabIndex') !== null)\n  ) {\n    return true;\n  }\n\n  if (el.disabled) {\n    return false;\n  }\n\n  /* eslint-disable indent */\n  switch (el.nodeName) {\n    case 'A':\n      return !!el.href && el.rel !== 'ignore';\n    case 'INPUT':\n      return el.type !== 'hidden' && el.type !== 'file';\n    case 'BUTTON':\n    case 'SELECT':\n    case 'TEXTAREA':\n      return true;\n    default:\n      return false;\n  }\n  /* eslint-enable indent */\n};\n\n// /**\n// * Key code list object\n// */\nexport const keyCode = {\n  TAB: 9,\n  RETURN: 13,\n  ESC: 27,\n  SPACE: 32,\n  PAGEUP: 33,\n  PAGEDOWN: 34,\n  END: 35,\n  HOME: 36,\n  LEFT: 37,\n  UP: 38,\n  RIGHT: 39,\n  DOWN: 40\n};\n\n// /**\n// * Breakpoints list object\n// */\nexport const breakpoints = {\n  mobile: 360,\n  tablet: 768,\n  tabletLandscape: 1024,\n  desktop: 1280,\n  wide: 1600\n};\n\n// /**\n// * Bicentennial Swiper Object\n// */\n\nexport const bicentennialSwiperConfig = {\n  allowTouchMove: false,\n  autoHeight: false,\n  rewind: true,\n  slidesPerView: 1,\n  spaceBetween: 0,\n  speed: 1000,\n  watchOverflow: true,\n  watchSlidesProgress: true\n}\n\n// /**\n// * Convert Unicode characters inside a string to their actual characters\n// */\n\nexport const convertUnicode = (input) => {\n  if (typeof input === 'string') {\n    return input.replace(/\\\\+u([0-9a-fA-F]{4})/g, (a, b) =>\n      String.fromCharCode(parseInt(b, 16)))\n  }\n  return input;\n};\n","import { Component } from '@verndale/core';\nimport Swiper, { Navigation, Pagination, A11y } from 'swiper';\nimport { breakpoints, bicentennialSwiperConfig, debounce } from '../../helpers/index';\n\nSwiper.use([Navigation, Pagination, A11y]);\n\nclass CrossLinkBlock extends Component {\n  setupDefaults() {\n    this.dom = {\n      swiperContainer: this.el.querySelector(\n        '.swiper-container'\n      ),\n      swiperSlides: this.el.querySelectorAll(\n        '.swiper-slide'\n      ),\n      swiperPagination: this.el.querySelector(\n        '.swiper-pagination'\n      ),\n      swiperButtonPrev: this.el.querySelector(\n        '.swiper-btn-prev'\n      ),\n      swiperButtonNext: this.el.querySelector(\n        '.swiper-btn-next'\n      ),\n      swiperControls: this.el.querySelector(\n        '.swiper-controls'\n      )\n    };\n    this.initSlider();\n  }\n\n  toggleNavigation(swiper) {\n    if (swiper.isLocked) {\n      this.dom.swiperControls.style.display = 'none';\n    } else {\n      this.dom.swiperControls.style.removeProperty('display');\n    }\n  }\n\n  initSlider() {\n    const totalPanels = this.dom.swiperSlides.length;\n    const config = bicentennialSwiperConfig;\n\n    this.swiper = new Swiper(this.dom.swiperContainer, {\n      ...config,\n      breakpoints: {\n        [breakpoints.tablet]: {\n          slidesPerView: totalPanels > 2 ? 2 : totalPanels,\n          slidesPerGroup: totalPanels > 2 ? 2 : totalPanels\n        \n        },\n        [breakpoints.tabletLandscape]: {\n          slidesPerView: totalPanels\n        }\n      },\n      navigation: {\n        prevEl: this.dom.swiperButtonPrev,\n        nextEl: this.dom.swiperButtonNext\n      },\n      a11y: {\n        prevSlideMessage: this.el.dataset.previousSlideAriaLabel,\n        nextSlideMessage: this.el.dataset.nextSlideAriaLabel\n      },\n      pagination: {\n        el: this.dom.swiperPagination,\n        clickable: true,\n      },\n      on: {\n        init: this.toggleNavigation.bind(this),\n        resize: () => debounce(this.toggleNavigation.bind(this), 100)\n      }\n    });\n\n  }\n}\n\nexport default CrossLinkBlock;\n"],"sourceRoot":""}