!function(){if("function"!=typeof window.CustomEvent){var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e}function t(){return(t=Object.assign||function(e){for(var t=1;t0&&(t.currentTime=t.getAttribute("data-time")),d.autoplayVideo&&t.play())},onLeave:function(e){var t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime))},onCleanup:function(e){var t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){var n=t.cloneNode(!0);ae(t),t.load(),t.parentNode.removeChild(t),e.appendChild(n)}}},iframe:{checkSupport:function(e){return oe(e,"iframe")},init:function(e,t){var n=document.createElement("iframe"),i=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-target");n.setAttribute("frameborder","0"),n.setAttribute("src",""),n.setAttribute("data-src",i),e.getAttribute("data-width")&&(n.style.maxWidth=e.getAttribute("data-width")+"px"),e.getAttribute("data-height")&&(n.style.maxHeight=e.getAttribute("data-height")+"px"),t.appendChild(n),t.setAttribute("data-type","iframe")},onPreload:function(e){},onLoad:function(e){var t=e.querySelector("iframe");t.setAttribute("src",t.getAttribute("data-src"))},onLeave:function(e){},onCleanup:function(e){}},youtube:{checkSupport:function(e){return oe(e,"youtube")},init:function(e,t){var n=document.createElement("div");t.appendChild(n),a[A]=new window.YT.Player(n,{host:"https://www.youtube-nocookie.com",height:e.getAttribute("data-height")||"360",width:e.getAttribute("data-width")||"640",videoId:e.getAttribute("data-id"),playerVars:{controls:e.getAttribute("data-controls")||1,rel:0,playsinline:1}}),t.setAttribute("data-player",A),t.setAttribute("data-type","youtube"),A++},onPreload:function(e){},onLoad:function(e){d.autoplayVideo&&a[e.getAttribute("data-player")].playVideo()},onLeave:function(e){1===a[e.getAttribute("data-player")].getPlayerState()&&a[e.getAttribute("data-player")].pauseVideo()},onCleanup:function(e){1===a[e.getAttribute("data-player")].getPlayerState()&&a[e.getAttribute("data-player")].pauseVideo()}}},S=function(e){if(null===document.querySelector('[data-type="youtube"]')||E)k(e);else{if(null===document.getElementById("iframe_api")){var t=document.createElement("script"),n=document.getElementsByTagName("script")[0];t.id="iframe_api",t.src="https://www.youtube.com/iframe_api",n.parentNode.insertBefore(t,n)}-1===r.indexOf(e)&&r.push(e),window.onYouTubePlayerAPIReady=function(){r.forEach(function(e){k(e)}),E=!0}}},T=function(e){return e.hasAttribute("data-group")?e.getAttribute("data-group"):"default"},k=function(e){if(_=T(e),Object.prototype.hasOwnProperty.call(L,_)||(L[_]=JSON.parse(JSON.stringify(o)),N()),-1!==L[_].gallery.indexOf(e))throw new Error("Ups, element already added.");if(L[_].gallery.push(e),L[_].elementsLength++,d.zoom&&e.querySelector("img")){var t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=d.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",W),O(e),ue()&&_===C&&(de(),se())},P=function(e){var t=T(e);if(-1===L[t].gallery.indexOf(e))throw new Error("Ups, I can't find a slide for the element "+e+".");var n=L[t].gallery.indexOf(e),i=L[t].sliderElements[n];if(ue()&&t===C&&n===L[t].currentIndex){if(1===L[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===L[t].currentIndex?M():z()}if(L[t].elementsLength--,d.zoom&&e.querySelector(".tobii-zoom__icon")){var r=e.querySelector(".tobii-zoom__icon");r.parentNode.classList.remove("tobii-zoom"),r.parentNode.removeChild(r)}e.removeEventListener("click",W),i.parentNode.removeChild(i)},N=function(){L[_].slider=document.createElement("div"),L[_].slider.className="tobii__slider",L[_].slider.setAttribute("aria-hidden","true"),l.appendChild(L[_].slider)},O=function(e){for(var t in I)if(Object.prototype.hasOwnProperty.call(I,t)&&I[t].checkSupport(e)){var n=document.createElement("div"),i=document.createElement("div");n.className="tobii__slide",n.style.position="absolute",n.style.left=100*L[_].x+"%",n.setAttribute("aria-hidden","true"),I[t].init(e,i),n.appendChild(i),L[_].slider.appendChild(n),L[_].sliderElements.push(n),++L[_].x;break}},q=function(e){if(C=null!==C?C:_,ue())throw new Error("Ups, I'm aleady open.");if(!ue()&&(e||(e=0),-1===e||e>=L[C].elementsLength))throw new Error("Ups, I can't find slide "+e+".");d.hideScrollbar&&(document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open")),de(),d.close||(p.disabled=!1,p.setAttribute("aria-hidden","true")),g=document.activeElement;var t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),L[C].currentIndex=e,B(),ie(),Y(L[C].currentIndex),L[C].slider.setAttribute("aria-hidden","false"),l.setAttribute("aria-hidden","false"),se(),U(L[C].currentIndex+1),U(L[C].currentIndex-1),setTimeout(function(){L[C].slider.classList.add("tobii__slider--animate")},1e3);var n=new window.CustomEvent("open");l.dispatchEvent(n)},X=function(){if(!ue())throw new Error("Ups, I'm already closed.");d.hideScrollbar&&(document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open")),re(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),g.focus(),D(L[C].currentIndex),H(L[C].currentIndex),l.setAttribute("aria-hidden","true"),L[C].slider.setAttribute("aria-hidden","true"),L[C].currentIndex=0,L[C].slider.classList.remove("tobii__slider--animate")},U=function(e){if(void 0!==L[C].sliderElements[e]){var t=L[C].sliderElements[e].querySelector("[data-type]"),n=t.getAttribute("data-type");I[n].onPreload(t)}},Y=function(e){if(void 0!==L[C].sliderElements[e]){var t=L[C].sliderElements[e].querySelector("[data-type]"),n=t.getAttribute("data-type");L[C].sliderElements[e].classList.add("tobii__slide--is-active"),L[C].sliderElements[e].setAttribute("aria-hidden","false"),I[n].onLoad(t)}},z=function(){if(!ue())throw new Error("Ups, I'm closed.");L[C].currentIndex>0&&(D(L[C].currentIndex),Y(--L[C].currentIndex),se("left"),H(L[C].currentIndex+1),U(L[C].currentIndex-1));var e=new window.CustomEvent("previous");l.dispatchEvent(e)},M=function(){if(!ue())throw new Error("Ups, I'm closed.");L[C].currentIndex0&&n>d.threshold&&L[C].currentIndex>0?z():e<0&&n>d.threshold&&L[C].currentIndex!==L[C].elementsLength-1?M():t<0&&i>d.threshold&&d.swipeClose?X():j()},R=function(){x||(x=!0,window.requestAnimationFrame(function(){j(),x=!1}))},W=function(e){e.preventDefault(),C=T(e.currentTarget),q(L[C].gallery.indexOf(e.currentTarget))},G=function(e){e.target===u?z():e.target===c?M():(e.target===p||!1===m&&!1===h&&e.target.classList.contains("tobii__slide")&&d.docClose)&&X(),e.stopPropagation()},J=function(e){var t=Array.prototype.slice.call(l.querySelectorAll(".tobii__btn:not([disabled]), .tobii__slide--is-active + "+i.join(", .tobii__slide--is-active "))).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}),n=t.indexOf(document.activeElement);9===e.keyCode||"Tab"===e.code?e.shiftKey&&0===n?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||n!==t.length-1||(t[0].focus(),e.preventDefault()):27===e.keyCode||"Escape"===e.code?(e.preventDefault(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),z()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),M())},K=function(e){pe(e.target)||(e.stopPropagation(),m=!1,h=!1,v=!0,f.startX=e.touches[0].pageX,f.startY=e.touches[0].pageY,L[C].slider.classList.add("tobii__slider--is-dragging"))},F=function(e){e.stopPropagation(),v&&(e.preventDefault(),f.endX=e.touches[0].pageX,f.endY=e.touches[0].pageY,ne())},$=function(e){e.stopPropagation(),v=!1,L[C].slider.classList.remove("tobii__slider--is-dragging"),f.endX&&V(),B()},Q=function(e){pe(e.target)||(e.preventDefault(),e.stopPropagation(),m=!1,h=!1,v=!0,f.startX=e.pageX,f.startY=e.pageY,L[C].slider.classList.add("tobii__slider--is-dragging"))},Z=function(e){e.preventDefault(),v&&(f.endX=e.pageX,f.endY=e.pageY,ne())},ee=function(e){e.stopPropagation(),v=!1,L[C].slider.classList.remove("tobii__slider--is-dragging"),f.endX&&V(),B()},te=function(){v=!1},ne=function(){Math.abs(f.startX-f.endX)>0&&!h&&L[C].elementsLength>1?(L[C].slider.style.transform="translate3d("+(w-Math.round(f.startX-f.endX))+"px, 0, 0)",m=!0,h=!1):Math.abs(f.startY-f.endY)>0&&!m&&d.swipeClose&&(L[C].slider.style.transform="translate3d("+w+"px, -"+Math.round(f.startY-f.endY)+"px, 0)",m=!1,h=!0)},ie=function(){d.keyboard&&window.addEventListener("keydown",J),window.addEventListener("resize",R),window.addEventListener("popstate",X),l.addEventListener("click",G),d.draggable&&(ce()&&(l.addEventListener("touchstart",K),l.addEventListener("touchmove",F),l.addEventListener("touchend",$)),l.addEventListener("mousedown",Q),l.addEventListener("mouseup",ee),l.addEventListener("mousemove",Z),l.addEventListener("contextmenu",te))},re=function(){d.keyboard&&window.removeEventListener("keydown",J),window.removeEventListener("resize",R),window.removeEventListener("popstate",X),l.removeEventListener("click",G),d.draggable&&(ce()&&(l.removeEventListener("touchstart",K),l.removeEventListener("touchmove",F),l.removeEventListener("touchend",$)),l.removeEventListener("mousedown",Q),l.removeEventListener("mouseup",ee),l.removeEventListener("mousemove",Z),l.removeEventListener("contextmenu",te))},oe=function(e,t){return e.getAttribute("data-type")===t},ae=function(e){var t=e.querySelectorAll("src");t&&t.forEach(function(e){e.setAttribute("src","")})},de=function(){(d.draggable&&d.swipeClose&&!L[C].slider.classList.contains("tobii__slider--is-draggable")||d.draggable&&L[C].elementsLength>1&&!L[C].slider.classList.contains("tobii__slider--is-draggable"))&&L[C].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===L[C].elementsLength||"auto"===d.nav&&ce()?(u.setAttribute("aria-hidden","true"),u.disabled=!0,c.setAttribute("aria-hidden","true"),c.disabled=!0):(u.setAttribute("aria-hidden","false"),u.disabled=!1,c.setAttribute("aria-hidden","false"),c.disabled=!1),b.setAttribute("aria-hidden",d.counter&&1!==L[C].elementsLength?"false":"true")},se=function(e){j(),b.textContent=L[C].currentIndex+1+"/"+L[C].elementsLength,function(e){(!0===d.nav||"auto"===d.nav)&&!ce()&&L[C].elementsLength>1?(u.setAttribute("aria-hidden","true"),u.disabled=!0,c.setAttribute("aria-hidden","true"),c.disabled=!0,1===L[C].elementsLength?d.close&&p.focus():0===L[C].currentIndex?(c.setAttribute("aria-hidden","false"),c.disabled=!1,c.focus()):L[C].currentIndex===L[C].elementsLength-1?(u.setAttribute("aria-hidden","false"),u.disabled=!1,u.focus()):(u.setAttribute("aria-hidden","false"),u.disabled=!1,c.setAttribute("aria-hidden","false"),c.disabled=!1,"left"===e?u.focus():c.focus())):d.close&&p.focus()}(e)},le=function(){ue()&&X(),Object.entries(L).forEach(function(e){e[1].gallery.forEach(function(e){P(e)})}),L={},_=C=null,s=0},ue=function(){return"false"===l.getAttribute("aria-hidden")},ce=function(){return"ontouchstart"in window},pe=function(e){return-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===u||e===c||e===p};return function(e){d=function(e){return t({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,nav:"auto",navText:['',''],navLabel:["Previous image","Next image"],close:!0,closeText:'',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},e)}(e),l||((l=document.createElement("div")).setAttribute("role","dialog"),l.setAttribute("aria-hidden","true"),l.classList.add("tobii"),l.classList.add(d.theme),(u=document.createElement("button")).className="tobii__btn tobii__btn--previous",u.setAttribute("type","button"),u.setAttribute("aria-label",d.navLabel[0]),u.innerHTML=d.navText[0],l.appendChild(u),(c=document.createElement("button")).className="tobii__btn tobii__btn--next",c.setAttribute("type","button"),c.setAttribute("aria-label",d.navLabel[1]),c.innerHTML=d.navText[1],l.appendChild(c),(p=document.createElement("button")).className="tobii__btn tobii__btn--close",p.setAttribute("type","button"),p.setAttribute("aria-label",d.closeLabel),p.innerHTML=d.closeText,l.appendChild(p),(b=document.createElement("div")).className="tobii__counter",l.appendChild(b),document.body.appendChild(l));var n=document.querySelectorAll(d.selector);if(!n)throw new Error("Ups, I can't find the selector "+d.selector+" on this website.");n.forEach(function(e){S(e)})}(e),n.open=q,n.previous=z,n.next=M,n.close=X,n.add=S,n.remove=P,n.reset=le,n.destroy=function(){le(),l.parentNode.removeChild(l)},n.isOpen=ue,n.slidesIndex=function(){return L[C].currentIndex},n.select=function(e){var t=L[C].currentIndex;if(!ue())throw new Error("Ups, I'm closed.");if(ue()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===L[C].currentIndex)throw new Error("Ups, slide "+e+" is already selected.");if(-1===e||e>=L[C].elementsLength)throw new Error("Ups, I can't find slide "+e+".")}L[C].currentIndex=e,D(t),Y(e),et&&(se("right"),H(t),U(e+1))},n.slidesCount=function(){return L[C].elementsLength},n.selectGroup=function(e){if(ue())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(L,e))throw new Error("Ups, I don't have a group called \""+e+'".');C=e},n.currentGroup=function(){return null!==C?C:_},n.on=function(e,t){l.addEventListener(e,t)},n.off=function(e,t){l.removeEventListener(e,t)},n}typeof module<"u"?module.exports=n:self.Tobii=n}();