{"version":3,"sources":["webpack:///./widgets/provenceMapSlider.js","webpack:///./loadWg/provenceMap.js"],"names":["WG","concat","ProvenceMapSlider","$el","_classCallCheck","this","key","value","initCarousel","loadProvenceMaps","handleIframe","loadProvenceMap","then","wgAll","length","forEach","wg","init","el","$","$carousel","find","$navLinks","$navPrev","$navNext","navWidth","outerWidth","scrollDistance","get","scrollWidth","scrollPos","on","$this","index","attr","slick","siblings","removeClass","addClass","arrows","fade","event","currentSlide","scrollLeft","animate","iframe","modal","closest","css","width","height","overflowY","document","body","maxHeight","paddingRight","documentElement","scrollTop","window","scrollPosition","$parentEl","isList","arguments","undefined","$wg","querySelector","ProvenceMap","$wgCol","querySelectorAll","instances","Array","from","i","push","error","Promise","reject"],"mappings":"w3BAIA,IAEMA,EAAK,IAAHC,OADI,oBACM,KAQLC,EAAiB,WAI5B,O,EAHD,SAAAA,EAAYC,I,4FAAKC,CAAA,KAAAF,GAEhBG,KAAKF,IAAMA,I,EACX,EAAAG,IAAA,OAAAC,MAED,WACCF,KAAKG,eACLH,KAAKI,mBACLJ,KAAKK,iBACL,CAAAJ,IAAA,mBAAAC,MAED,WACCI,YAAgBN,KAAKF,KAAK,GAAMS,MAAK,SAACC,GACpCA,GAASA,EAAMC,OAAS,GAAKD,EAAME,SAAQ,SAACC,GAC5CA,EAAGC,eAGL,CAAAX,IAAA,eAAAC,MAED,WACC,IAAMW,EAAKC,EAAEd,KAAKF,KACZiB,EAAYF,EAAGG,KAAK,GAADpB,OAAID,EAAE,aAEzBsB,EAAYJ,EAAGG,KAAK,GAADpB,OAAID,EAAE,aACzBuB,EAAWL,EAAGG,KAAK,GAADpB,OAAID,EAAE,mBACxBwB,EAAWN,EAAGG,KAAK,GAADpB,OAAID,EAAE,mBAC1ByB,EAAWH,EAAUI,aAErBC,EADkBL,EAAUM,IAAI,GAAGC,YACAJ,EACnCK,EAAY,EAEhBV,EAAUW,GAAG,QAAQ,WACpBb,EAAGG,KAAK,GAADpB,OAAID,EAAE,YAAW+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AAhBC,EAAMC,UAAAhD,OAAA,QAAAiD,IAAAD,UAAA,IAAAA,UAAA,GAG5CE,EAAMJ,EAAUK,cAAc,2BAElC,OAAID,EAKG,+BAAiFpD,MAAK,SAAAI,GAE5F,IAAQkD,EAAgBlD,EAAhBkD,YAER,IAAIL,EASH,OAAO,IAAIK,EAAYF,GARvB,IAAIG,EAASP,EAAUQ,iBAAiB,2BACpCC,EAAY,GAIhB,OAHAC,MAAMC,KAAKJ,GAAQpD,SAAQ,SAACiD,EAAKQ,GAChCH,EAAUI,KAAM,IAAIP,EAAYF,OAE7BK,EAAUvD,SAAWqD,EAAOrD,OAAeuD,OAA/C,KAOA,OAAO,SAAAK,GAAK,OAAIA,EAAM,4DApBhBC,QAAQC,OAAO,sDATxB","file":"58.js","sourcesContent":["/* eslint-disable no-unused-vars */\n/* eslint-disable no-invalid-this */\n/* eslint-disable max-len */\n// CONSTANTS are all caps.\nconst NS = 'ProvenceMapSlider';\nconst CLS = 'provenceMapSlider';\nconst WG = `.${CLS}-`;\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/provenceMapSlider.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\nimport {loadProvenceMap} from '../loadWg/provenceMap';\nimport utils from '../utils';\n\nexport class ProvenceMapSlider {\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadProvenceMapSlider function\n\t\tthis.$el = $el;\n\t}\n\n\tinit() {\n\t\tthis.initCarousel();\n\t\tthis.loadProvenceMaps();\n\t\tthis.handleIframe();\n\t}\n\n\tloadProvenceMaps() {\n\t\tloadProvenceMap(this.$el, true).then((wgAll) => {\n\t\t\t(wgAll && wgAll.length > 0) ? wgAll.forEach((wg) => {\n\t\t\t\twg.init();\n\t\t\t}) : '';\n\t\t});\n\t}\n\n\tinitCarousel() {\n\t\tconst el = $(this.$el);\n\t\tconst $carousel = el.find(`${WG}carousel`);\n\t\tconst navActiveClass = 'is-active';\n\t\tconst $navLinks = el.find(`${WG}navLinks`);\n\t\tconst $navPrev = el.find(`${WG}navArrow--prev`);\n\t\tconst $navNext = el.find(`${WG}navArrow--next`);\n\t\tlet navWidth = $navLinks.outerWidth();\n\t\tlet navContentWidth = $navLinks.get(0).scrollWidth;\n\t\tlet scrollDistance = navContentWidth - navWidth;\n\t\tlet scrollPos = 0;\n\n\t\t$carousel.on('init', () => {\n\t\t\tel.find(`${WG}navLink`).on('click', function() {\n\t\t\t\tlet $this = $(this);\n\t\t\t\tlet index = $this.attr('data-slide-index');\n\n\t\t\t\t$carousel.slick('slickGoTo', index);\n\t\t\t\t$this.siblings().removeClass(navActiveClass);\n\t\t\t\t$this.addClass(navActiveClass);\n\t\t\t});\n\t\t}).slick({\n\t\t\tarrows: false,\n\t\t\tfade: true,\n\t\t}).on('afterChange', (event, slick, currentSlide) => {\n\t\t\tel.find(`${WG}navLink`).removeClass(navActiveClass);\n\t\t\tel.find(`${WG}navLink[data-slide-index=${currentSlide}]`).addClass(navActiveClass);\n\t\t});\n\n\t\t$navPrev.on('click', () => {\n\t\t\tscrollPos = $navLinks.scrollLeft();\n\t\t\tif (scrollPos > 0) {\n\t\t\t\tscrollPos -= scrollDistance / 2;\n\t\t\t\tscrollPos = scrollPos < 0 ? 0 : scrollPos;\n\t\t\t\t$navLinks.animate({\n\t\t\t\t\tscrollLeft: scrollPos,\n\t\t\t\t}, 200);\n\t\t\t}\n\t\t});\n\n\t\t$navNext.on('click', () => {\n\t\t\tscrollPos = $navLinks.scrollLeft();\n\t\t\tif (scrollPos < scrollDistance) {\n\t\t\t\tscrollPos += scrollDistance / 2;\n\t\t\t\tscrollPos = scrollPos > scrollDistance ? scrollDistance : scrollPos;\n\t\t\t\t$navLinks.animate({\n\t\t\t\t\tscrollLeft: scrollPos,\n\t\t\t\t}, 200);\n\t\t\t}\n\t\t});\n\t}\n\n\thandleIframe() {\n\t\tlet iframe = $('iframe.farmItem-modalContent');\n\t\tlet modal = iframe.closest('.modal');\n\n\t\tmodal.on('shown.bs.modal', () => {\n\t\t\tiframe.css({\n\t\t\t\twidth: '100%',\n\t\t\t\theight: iframe.closest('.modal-body').height(),\n\t\t\t});\n\n\t\t\tmodal.css({\n\t\t\t\toverflowY: 'hidden !important',\n\t\t\t});\n\n\t\t\tmodal.find('.modal-body').css({\n\t\t\t\toverflowY: 'hidden !important',\n\t\t\t});\n\n\t\t\tmodal.addClass('px-0');\n\n\t\t\t$(document.body).css({\n\t\t\t\toverflowY: 'hidden',\n\t\t\t\tmaxHeight: '100vh',\n\t\t\t\tpaddingRight: 0,\n\t\t\t});\n\t\t});\n\n\t\tmodal.on('hidden.bs.modal', () => {\n\t\t\t$(document.body).css({\n\t\t\t\toverflowY: '',\n\t\t\t\tmaxHeight: '',\n\t\t\t\tpaddingRight: '',\n\t\t\t});\n\n\t\t\tdocument.documentElement.scrollTop = window.scrollPosition || 0;\n\t\t});\n\t}\n}\n","// Function loadProvenceMap loads the ProvenceMap class by dynamically importing the js on demand if needed\n\nexport function loadProvenceMap($parentEl, isList = false) {\n\n\n\tlet $wg = $parentEl.querySelector('[data-wg=\"ProvenceMap\"]');\n\n\tif(!$wg) {\n\t\t// console.info('ProvenceMap: no widget found');\n\t\treturn Promise.reject('ProvenceMap widget not found in the parent element');\n\t}\n\n\treturn import(/* webpackChunkName: \"wg-provence-map-chunk\" */ '../widgets/provenceMap').then(wg => {\n\n\t\tconst { ProvenceMap } = wg;\n\n\t\tif (isList) {\n\t\t\tlet $wgCol = $parentEl.querySelectorAll('[data-wg=\"ProvenceMap\"]');\n\t\t\tlet instances = [];\n\t\t\tArray.from($wgCol).forEach(($wg, i) => {\n\t\t\t\tinstances.push( new ProvenceMap($wg) );\n\t\t\t});\n\t\t\tif (instances.length === $wgCol.length) return instances;\n\n\t\t} else {\n\t\t\treturn new ProvenceMap($wg);\n\t\t}\n\n\n\t}).catch(error => error+'An error occurred while loading the ProvenceMap widget');\n\n}\n"],"sourceRoot":""}