{"version":3,"sources":["webpack:///./app/components/m/image-set/index.js","webpack:///./app/components/m/modal/index.js"],"names":["$","each","index","element","slidesNumber","getElementsByClassName","length","Swiper","querySelector","slidesPerView","spaceBetween","watchOverflow","centerInsufficientSlides","observer","observeParents","pagination","el","type","clickable","breakpointsInverse","breakpoints","document","on","e","_set$swiper","preventDefault","dynModal","BModal","elem","set","closest","activeSlide","swiper","clickedIndex","imageSet","querySelectorAll","zoomableSet","images","Array","from","setBody","map","image","dataset","src","join","firstElementChild","show","modal","modalSwiper","initialSlide","modules","Pagination","constructor","classes","arguments","undefined","container","modalMarkup","remove","body","append","modalHeader","find","modalBody","setClasses","addClass","setHeader","markup","once","before","html","setFooter","after","delay","that","Number","isInteger","timeid","setTimeout"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAuC;AACK;AAE5CA,CAAC,CAAC,YAAY,CAAC,CAACC,IAAI,CAAC,CAACC,KAAK,EAAEC,OAAO,KAAK;EACvC;EACA,MAAMC,YAAY,GAAGD,OAAO,CAACE,sBAAsB,CAAC,kBAAkB,CAAC,CAACC,MAAM;EAC9E,IAAIF,YAAY,GAAG,CAAC,EAAE;IACpB,OAAO,IAAIG,6CAAM,CAACJ,OAAO,CAACK,aAAa,CAAC,uBAAuB,CAAC,EAAE;MAChEC,aAAa,EAAE,MAAM;MACrBC,YAAY,EAAE,EAAE;MAChBC,aAAa,EAAE,IAAI;MACnBC,wBAAwB,EAAE,IAAI;MAC9BC,QAAQ,EAAE,IAAI;MACdC,cAAc,EAAE,IAAI;MACpBC,UAAU,EAAE;QACVC,EAAE,EAAEb,OAAO,CAACK,aAAa,CAAC,oBAAoB,CAAC;QAC/CS,IAAI,EAAE,SAAS;QACfC,SAAS,EAAE;MACb,CAAC;MACDC,kBAAkB,EAAE,IAAI;MACxBC,WAAW,EAAE;QACX,GAAG,EAAE;UACHX,aAAa,EAAEL,YAAY;UAC3BM,YAAY,EAAE;QAChB;MACF;IACF,CAAC,CAAC;EACJ;AACF,CA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B,KAAK,CAAC;IACX;IACA,IAAI,CAAC1B,KAAK,CAACA,KAAK,CAAC,MAAM,CAAC;EAC1B;AACF","file":"image-set.chunk.js","sourcesContent":["import { BModal } from '../../m/modal';\r\nimport { Swiper, Pagination } from 'swiper';\r\n\r\n$('.image-set').each((index, element) => {\r\n  // calculate number of slides so that all slides can be seen on desktop\r\n  const slidesNumber = element.getElementsByClassName('image-set__image').length;\r\n  if (slidesNumber > 1) {\r\n    return new Swiper(element.querySelector('.image-set__container'), {\r\n      slidesPerView: 'auto',\r\n      spaceBetween: 10,\r\n      watchOverflow: true,\r\n      centerInsufficientSlides: true,\r\n      observer: true,\r\n      observeParents: true,\r\n      pagination: {\r\n        el: element.querySelector('.swiper-pagination'),\r\n        type: 'bullets',\r\n        clickable: true,\r\n      },\r\n      breakpointsInverse: true,\r\n      breakpoints: {\r\n        576: {\r\n          slidesPerView: slidesNumber,\r\n          spaceBetween: 0,\r\n        },\r\n      },\r\n    });\r\n  }\r\n});\r\n\r\n// modal\r\n$(document).on('click', '.image-modal__toggle', function (e) {\r\n  e.preventDefault();\r\n  const dynModal = new BModal('modal--image modal--fullscreen');\r\n  const elem = this;\r\n  const set = elem.closest('.swiper');\r\n  const activeSlide = set.swiper?.clickedIndex;\r\n  const imageSet = set.querySelectorAll('.image-set__image');\r\n\r\n  const zoomableSet = set.querySelectorAll('.zoomable');\r\n\r\n  //if every image in set is zoomable then set swiper\r\n  if (imageSet.length > 1 && imageSet.length == zoomableSet.length) {\r\n    const images = Array.from(imageSet);\r\n    dynModal.setBody(`<div class=\" image-set__container--modal swiper\">\r\n            <div class=\"swiper-wrapper\">\r\n            ${images\r\n              .map(\r\n                (image) => `\r\n                  <div class=\"swiper-slide\">\r\n                    <div class=\"content\">\r\n                      <div class=\"image-set__image lazyload\" data-bgset=\"${image.dataset.src}\"></div>\r\n                    </div>\r\n                  </div>`\r\n              )\r\n              .join('')}\r\n            </div>\r\n            <div class=\"swiper-pagination\"></div>\r\n        </div>`);\r\n    // else just show one picture\r\n  } else {\r\n    const src = elem.firstElementChild.dataset.src;\r\n    dynModal.setBody(`<div class=\"image-set__image lazyload\" data-bgset=\"${src}\"></div>`);\r\n  }\r\n\r\n  dynModal.show();\r\n\r\n  dynModal.modal.on('shown.bs.modal', (e) => {\r\n    const modalSwiper = new Swiper('.image-set__container--modal', {\r\n      slidesPerView: 'auto',\r\n      initialSlide: activeSlide,\r\n      spaceBetween: 10,\r\n      watchOverflow: true,\r\n      modules: [Pagination],\r\n      pagination: {\r\n        el: '.swiper-pagination',\r\n        type: 'bullets',\r\n        clickable: true,\r\n      },\r\n    });\r\n  });\r\n});\r\n","/**\r\n * Bootstrap Modal with pure Javascript\r\n * Usage:\r\n * var my_modal = new bsModal();\r\n * my_modal.setBody('Some content');\r\n * my_modal.setFooter('Footer');\r\n * my_modal.modal.modal('show');\r\n * @param  {string} classes [css classes]\r\n */\r\n\r\nclass BModal {\r\n  constructor(classes = '', container = true) {\r\n    const modalMarkup =\r\n      '<div id=\"BModal\" tabindex=\"-1\" class=\"modal ' +\r\n      classes +\r\n      ' fade in\">' +\r\n      '<div class=\"modal-dialog\">' +\r\n      '<div class=\"modal-content\">' +\r\n      '<div class=\"modal-header\">' +\r\n      '<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"close\"><svg class=\"icon icon-close\"><use xlink:href=\"#icon-close\"></use></svg></button>' +\r\n      '</button>' +\r\n      '</div>' +\r\n      `<div class=\"modal-body ${container ? 'container' : ''}\"></div>` +\r\n      '</div>' +\r\n      '</div>' +\r\n      '</div>';\r\n    this.modal = $('#BModal');\r\n    // Remove modal if there's already one\r\n    this.modal.remove();\r\n    // Append markup\r\n    $(document.body).append(modalMarkup);\r\n    this.modal = $('#BModal');\r\n    this.modalHeader = this.modal.find('.modal-header');\r\n    this.modalBody = this.modal.find('.modal-body');\r\n    // Kill on Hide\r\n    this.modal.on('hidden.bs.modal', function () {\r\n      $(this).remove();\r\n    });\r\n  }\r\n\r\n  // Set variant class\r\n  setClasses(classes) {\r\n    this.modal.addClass(classes);\r\n  }\r\n\r\n  // Set Body\r\n  setHeader(markup, once = false) {\r\n    // only add markup if once is explicitly set\r\n    // and element wasn't added yet\r\n    if (once && this.modalHeader.find('.modal-header__content').length) return;\r\n\r\n    this.modalHeader.find('.close').before(`<div class=\"modal-header__content\">${markup}</div>`);\r\n  }\r\n\r\n  // Set Body\r\n  setBody(markup) {\r\n    this.modalBody.html(markup);\r\n  }\r\n\r\n  // Set Footer\r\n  setFooter(markup) {\r\n    this.modalBody.after('<div class=\"modal-footer\">' + markup + '</div>');\r\n  }\r\n\r\n  // Display modal\r\n  show(delay) {\r\n    const that = this;\r\n    delay = Number(delay);\r\n    if (Number.isInteger(delay)) {\r\n      const timeid = setTimeout(() => {\r\n        that.modal.modal('hide');\r\n      }, delay);\r\n    }\r\n    this.modal.modal('show');\r\n  }\r\n}\r\n\r\nexport { BModal };\r\n"],"sourceRoot":""}