{"version":3,"sources":["webpack:///./LeLab.Web/src/js/gallery.entry.js"],"names":["PageComponent","constructor","node","this","id","slider","items","querySelectorAll","mediaViewerId","dataset","clickHandler","click","bind","addEventListener","sliderOpts","container","querySelector","prevButton","nextButton","nav","autoWidth","gutter","center","loop","speed","startIndex","PageState","get","onInit","classList","remove","length","TinySlider","events","on","i","set","Math","max","displayIndex","window","matchMedia","matches","e","item","target","closest","index","slideIndex","PageSubset","open","destroy","removeEventListener"],"mappings":"4FAAA,0BA+EA,IAAIA,IAAc,WA5ElB,MAEIC,aAAY,KAAEC,IACVC,KAAKD,KAAOA,EACZC,KAAKC,GAAKD,KAAKD,KAAKE,GACpBD,KAAKE,OAAS,KACdF,KAAKG,MAAQH,KAAKD,KAAKK,iBAAiB,kBACxCJ,KAAKK,cAAgBL,KAAKD,KAAKO,QAAQD,cAEvCL,KAAKO,aAAeP,KAAKQ,MAAMC,KAAKT,MACpCA,KAAKD,KAAKW,iBAAiB,QAASV,KAAKO,cAEzCP,KAAKW,WAAa,KAAM,CACpBC,UAAWZ,KAAKD,KAAKc,cAAc,iBACnCC,WAAYd,KAAKD,KAAKc,cAAc,kBACpCE,WAAYf,KAAKD,KAAKc,cAAc,kBACpCG,KAAK,EACLC,WAAW,EACXC,OAAQlB,KAAKkB,SACbC,QAAQ,EACRC,MAAM,EACNC,MAAO,IACPC,WAAYtB,KAAKC,IAAMsB,IAAUC,IAAIxB,KAAKC,KAAMsB,IAAUC,IAAIxB,KAAKC,KAAW,EAC9EwB,OAAQ,KACJzB,KAAKD,KAAK2B,UAAUC,OAAO,gBAI/B3B,KAAKG,MAAMyB,OAAS,IACpB5B,KAAKE,OAAS,IAAI2B,IAAW7B,KAAKW,YAC9BX,KAAKC,IACLD,KAAKE,OAAO4B,OAAOC,GAAG,eAAgBC,IAClCT,IAAUU,IAAIjC,KAAKC,GAAIiC,KAAKC,IAAI,EAAGH,EAAEI,aAAe,OAMpElB,SACI,OAAImB,OAAOC,WAAW,uBAAuBC,QAClC,GAEPF,OAAOC,WAAW,sBAAsBC,QACjC,GAEPF,OAAOC,WAAW,sBAAsBC,QACjC,GAEJ,GAGX/B,MAAMgC,GACF,MAAMC,EAAOD,EAAEE,OAAOC,QAAQ,kBAC9B,IAAKF,EAAM,OACX,MAAMG,EAAQH,EAAKnC,QAAQuC,WAC3BC,IAAWC,KAAK/C,KAAKK,cAAe,CAAE,WAAc6B,KAAKC,IAAI,EAAGS,KAGpEI,UACIhD,KAAKD,KAAKkD,oBAAoB,QAASjD,KAAKO,cAExCP,KAAKE,QAAUF,KAAKE,OAAO8C,SAC3BhD,KAAKE,OAAO8C,iBAGThD,KAAKD,YACLC,KAAKC,UACLD,KAAKE,cACLF,KAAKG,aACLH,KAAKK,qBACLL,KAAKO,oBACLP,KAAKW,gB","file":"gallery.js","sourcesContent":["import { PageComponent, PageState, PageSubset } from \"barba\"\r\nimport TinySlider from \"utils/tiny-slider\"\r\n\r\nclass GalleryClass {\r\n\r\n constructor({ node }) {\r\n this.node = node\r\n this.id = this.node.id\r\n this.slider = null\r\n this.items = this.node.querySelectorAll('.gallery__item')\r\n this.mediaViewerId = this.node.dataset.mediaViewerId\r\n\r\n this.clickHandler = this.click.bind(this)\r\n this.node.addEventListener(\"click\", this.clickHandler)\r\n\r\n this.sliderOpts = () => ({\r\n container: this.node.querySelector('.gallery__tns'),\r\n prevButton: this.node.querySelector('.gallery__prev'),\r\n nextButton: this.node.querySelector('.gallery__next'),\r\n nav: false,\r\n autoWidth: true,\r\n gutter: this.gutter(),\r\n center: true,\r\n loop: true,\r\n speed: 500,\r\n startIndex: this.id && PageState.get(this.id) ? PageState.get(this.id) || 0 : 0,\r\n onInit: () => {\r\n this.node.classList.remove(\"opacity-0\")\r\n }\r\n })\r\n\r\n if (this.items.length > 1) {\r\n this.slider = new TinySlider(this.sliderOpts)\r\n if (this.id) {\r\n this.slider.events.on('indexChanged', i => {\r\n PageState.set(this.id, Math.max(0, i.displayIndex - 1))\r\n })\r\n }\r\n }\r\n }\r\n\r\n gutter() {\r\n if (window.matchMedia(\"(min-width: 1440px)\").matches) {\r\n return 48\r\n }\r\n if (window.matchMedia(\"(min-width: 992px)\").matches) {\r\n return 32\r\n }\r\n if (window.matchMedia(\"(min-width: 768px)\").matches) {\r\n return 24\r\n }\r\n return 16\r\n }\r\n\r\n click(e) {\r\n const item = e.target.closest('.gallery__item')\r\n if (!item) return\r\n const index = item.dataset.slideIndex\r\n PageSubset.open(this.mediaViewerId, { 'startIndex': Math.max(0, index) })\r\n }\r\n\r\n destroy() {\r\n this.node.removeEventListener(\"click\", this.clickHandler)\r\n\r\n if (this.slider && this.slider.destroy) {\r\n this.slider.destroy()\r\n }\r\n \r\n delete this.node\r\n delete this.id\r\n delete this.slider\r\n delete this.items\r\n delete this.mediaViewerId\r\n delete this.clickHandler\r\n delete this.sliderOpts\r\n }\r\n\r\n}\r\n\r\nnew PageComponent(\".gallery\", GalleryClass)"],"sourceRoot":""}