!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,function(t){"use strict";function R(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function y(n){for(var t=1;tt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){for(var t=!1,e=arguments.length,i=new Array(e),n=0;nthis.option("wheelLimit")||(t.preventDefault(),n===i)||(e=this.$content.getBoundingClientRect(),i=t.clientX-e.left,t=t.clientY-e.top,this.zoomTo(n,{x:i,y:t}))}},{key:"zoomWithClick",value:function(t){var e=this.$content.getClientRects()[0],i=t.clientX-e.left,t=t.clientY-e.top;this.toggleZoom({x:i,y:t})}},{key:"attachEvents",value:function(){var l=this,c=(this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver(),new j(this.$container,{start:function(t,e){if(!l.option("touch"))return!1;if(l.velocity.scale<0)return!1;var r=e.composedPath()[0];if(!c.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(r.nodeName))return!1;if(l.option("textSelection")&&function(t,e){for(var i=r.childNodes,n=document.createRange(),o=0;o=s.left&&e>=s.top&&t<=s.right&&e<=s.bottom)return a}}}(t.clientX,t.clientY))return!1}return!h(r)&&!1!==l.trigger("touchStart",e)&&("mousedown"===e.type&&e.preventDefault(),l.state="pointerdown",l.resetDragPosition(),l.dragPosition.midPoint=null,l.dragPosition.time=Date.now(),!0)},move:function(t,e,i){if("pointerdown"===l.state)if(!1!==l.trigger("touchMove",i)){if(!(e.length<2&&!0===l.option("panOnlyZoomed")&&l.content.width<=l.viewport.width&&l.content.height<=l.viewport.height&&l.transform.scale<=l.option("baseScale"))&&(!(1i+.5*(e-i)?i:e;this.zoomTo(i,t)}},{key:"zoomTo",value:function(){var t=0s.to),n&&(t=this.content.yn.to),(a||o)&&(o=((a?s.from:s.to)-this.content.x)*i,(a=this.content.x+(this.velocity.x+o)/this.friction)>=s.from&&a<=s.to&&(o+=this.velocity.x),this.velocity.x=o,this.recalculateTransform()),t||e)&&(a=((t?n.from:n.to)-this.content.y)*i,(s=this.content.y+(a+this.velocity.y)/this.friction)>=n.from&&s<=n.to&&(a+=this.velocity.y),this.velocity.y=a,this.recalculateTransform())}},{key:"setDragResistance",value:function(){var t,e,i,n,o,a;"pointerdown"===this.state&&(o=(i=this.getBounds(this.dragPosition.scale)).boundX,i=i.boundY,o&&(n=this.dragPosition.xo.to),i&&(t=this.dragPosition.yi.to),!n&&!a||n&&a||(n=(a=n?o.from:o.to)-this.dragPosition.x,this.dragPosition.x=a-.3*n),!t&&!e||t&&e||(a=(o=t?i.from:i.to)-this.dragPosition.y,this.dragPosition.y=o-.3*a))}},{key:"setDragForce",value:function(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}},{key:"recalculateTransform",value:function(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}},{key:"isAnimating",value:function(){return!(!this.friction||!(.05=t-1&&this.$next.setAttribute("disabled","")))}},{key:"cleanup",value:function(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.carousel.on("refresh change",this.onRefresh)}},{key:"detach",value:function(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}]);var C=V;function V(t){r(this,V),this.$container=null,this.$prev=null,this.$next=null,this.carousel=t,this.onRefresh=this.onRefresh.bind(this)}C.defaults={prevTpl:'',nextTpl:'',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};e(K,[{key:"buildList",value:function(){var t,i=this;if(!(this.carousel.pages.lengthi)&&(e.push({indexes:[],slides:[]}),c=e.length-1,h=0),h+=u.width,e[c].indexes.push(d),e[c].slides.push(u)}var f=this.option("center"),v=this.option("fill");e.forEach(function(t,e){t.index=e,t.width=t.slides.reduce(function(t,e){return t+e.width},0),t.left=t.slides[0].left,f&&(t.left+=.5*(i-t.width)*-1),v&&!o.option("infiniteX",o.option("infinite"))&&i(i-=h*(l+u+f))&&t.lefti&&t.lefti&&t.leftc&&t.left<=c+l+f&&(e=0)):s.removeSlideEl(t),t.hasDiff=e}),0),o=0;this.slides.forEach(function(t,e){var i=0;t.$el?(e!==n||t.hasDiff?i=o+t.hasDiff*r:o=0,t.$el.style.left=.1n&&(t.content.x-=i,this.pageIndex=this.pageIndex+this.pages.length,e=!0),e&&"pointerdown"===t.state&&t.resetDragPosition(),e}},{key:"onTouchEnd",value:function(t,e){var i=this.option("dragFree");!i&&1e}));return n?[n=this.findPageForSlide(n.index),n+i*t]:[0,0]}},{key:"setPage",value:function(t,e){var i,n,o=0,a=parseInt(t,10)||0,s=this.page,r=this.pageIndex,l=this.pages.length,c=this.contentWidth,h=this.viewportWidth;return t=(a%l+l)%l,this.option("infiniteX",this.option("infinite"))&&h=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}},{key:"onClosing",value:function(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}},{key:"onKeydown",value:function(t,e){e===t.option("Thumbs.key")&&this.toggle()}},{key:"build",value:function(){var t,i=this;this.$container||((t=document.createElement("div")).classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(t,this.fancybox.$carousel.nextSibling),this.Carousel=new E(t,v(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",function(t,e){e.preventDefault(),i.fancybox[e.deltaY<0?"prev":"next"]()}),this.$container=t,this.state="visible")}},{key:"getSlides",value:function(){var t,e=[],i=k(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=n.thumb;o&&e.push({html:this.fancybox.option("Thumbs.tpl").replace(/\{\{src\}\}/gi,o),customClass:"has-thumb has-".concat(n.type||"image")})}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"toggle",value:function(){"visible"===this.state?this.hide():"hidden"===this.state?this.show():this.build()}},{key:"show",value:function(){"hidden"===this.state&&(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),this.state="visible")}},{key:"hide",value:function(){"visible"===this.state&&(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",this.state="hidden")}},{key:"cleanup",value:function(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),it);function it(t){r(this,it),this.fancybox=t,this.$container=null,this.state="init";for(var e=0,i=["onPrepare","onClosing","onKeydown"];e'};function ot(t,e){for(var i=new URL(t),i=new URLSearchParams(i.search),n=new URLSearchParams,o=0,a=[].concat(b(i),b(Object.entries(e)));o\n Sorry, your browser doesn\'t support embedded videos.',format:""}},C=(e(st,[{key:"onInit",value:function(){var t,e=k(this.fancybox.items);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.processType(i)}}catch(t){e.e(t)}finally{e.f()}}},{key:"processType",value:function(t){var e,i,n,o,a;t.html?(t.src=t.html,t.type="html",delete t.html):(e=t.src||"",i=t.type||this.fancybox.options.type,n=null,e&&"string"!=typeof e||((n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i))?(o=ot(e,this.fancybox.option("Html.youtube")),a=encodeURIComponent(n[1]),t.videoId=a,t.src="https://www.youtube-nocookie.com/embed/".concat(a,"?").concat(o),t.thumb=t.thumb||"https://i.ytimg.com/vi/".concat(a,"/mqdefault.jpg"),t.vendor="youtube",i="video"):(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/))?(o=ot(e,this.fancybox.option("Html.vimeo")),a=encodeURIComponent(n[1]),t.videoId=a,t.src="https://player.vimeo.com/video/".concat(a,"?").concat(o),t.vendor="vimeo",i="video"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src="//maps.google.".concat(n[1],"/?ll=").concat((n[2]?n[2]+"&z="+Math.floor(n[3])+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&"),"&output=").concat(n[4]&&0n||i / ',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'\n \n \n ',click:function(t){t.preventDefault(),_.element()?_.deactivate():_.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'\n \n \n ',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'',click:function(t){t.preventDefault();t=this.fancybox.getSlide().Panzoom;t&&t.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'',click:function(t){t.stopPropagation();t=this.fancybox.plugins.Thumbs;t&&t.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'',attr:{"data-fancybox-close":"",tabindex:0}}}},ut=(e(ft,[{key:"onInit",value:function(){if(this.fancybox.option("Toolbar.autoEnable")){var t,e=!1,i=k(this.fancybox.items);try{for(i.s();!(t=i.n()).done;)if("image"===t.value.type){e=!0;break}}catch(t){i.e(t)}finally{i.f()}if(!e)return void(this.state="disabled")}var n,o=k(this.fancybox.option("Toolbar.display"));try{for(o.s();!(n=o.n()).done;){var a=n.value;if("close"===(p(a)?a.id:a)){this.fancybox.options.closeButton=!1;break}}}catch(t){o.e(t)}finally{o.f()}}},{key:"onPrepare",value:function(){var t=this.fancybox;if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new ht(t),!t.Carousel.prevPage)&&(t.option("slideshow.autoStart")&&this.Slideshow.activate(),t.option("fullscreen.autoStart"))&&!_.element())try{_.activate(t.$container)}catch(t){}}},{key:"onFsChange",value:function(){window.scrollTo(_.pageXOffset,_.pageYOffset)}},{key:"onSettle",value:function(){var t=this.fancybox,e=this.Slideshow;e&&e.isActive()&&(t.getSlide().index!==t.Carousel.slides.length-1||t.option("infinite")?"done"===t.getSlide().state&&e.setTimer():e.deactivate())}},{key:"onChange",value:function(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}},{key:"onDone",value:function(t,e){var i=this.Slideshow;e.index===t.getSlide().index&&(this.update(),i)&&i.isActive()&&(t.option("infinite")||e.index!==t.Carousel.slides.length-1?i.setTimer():i.deactivate())}},{key:"onRefresh",value:function(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow)||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate()}},{key:"onKeydown",value:function(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}},{key:"onClosing",value:function(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}},{key:"createElement",value:function(t){var e,i;for(i in"div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button")).classList.add("carousel__button"),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class&&(n=e.classList).add.apply(n,b(t.class.split(" "))),t.attr)e.setAttribute(i,t.attr[i]);t.label&&e.setAttribute("title",this.fancybox.localize("{{".concat(t.label,"}}"))),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");var n=e.querySelector("svg");return n&&(n.setAttribute("role","img"),n.setAttribute("tabindex","-1"),n.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}},{key:"build",value:function(){var o=this;this.cleanup();var a,s=this.fancybox.option("Toolbar.items"),r=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],l=this.fancybox.plugins.Thumbs,t=k(this.fancybox.option("Toolbar.display"));try{for(t.s();!(a=t.n()).done;)!function(){var e,t=a.value,i=void 0,n=void 0,n=p(t)?(i=t.id,v({},s[i],t)):s[i=t];if(["counter","next","prev","slideshow"].includes(i)&&o.fancybox.items.length<2)return;if("fullscreen"===i){if(!document.fullscreenEnabled||window.fullScreen)return;document.addEventListener("fullscreenchange",o.onFsChange)}("thumbs"!==i||l&&"disabled"!==l.state)&&n&&(e=n.position||"right",(t=r.find(function(t){return t.position===e}))&&t.items.push(n))}()}catch(o){t.e(o)}finally{t.f()}var e=document.createElement("div");e.classList.add("fancybox__toolbar");for(var i=0,n=r;il.option("baseScale"),h=k(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=k(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;)u.value.innerHTML=e.index+1}catch(t){f.e(t)}finally{f.f()}var v,p=k(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(p.s();!(v=p.n()).done;)v.value.innerHTML=n}catch(t){p.e(t)}finally{p.f()}if(!this.fancybox.option("infinite")){var g,m=k(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(g=m.n()).done;){var y=g.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,x=k(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(x.s();!(b=x.n()).done;){var w=b.value;i===n-1?w.setAttribute("disabled",""):w.removeAttribute("disabled")}}catch(t){x.e(t)}finally{x.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),ft);function ft(t){var i=this;r(this,ft),this.fancybox=t,this.$container=null,this.state="init";for(var e=0,n=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];e',spinner:'',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},O=new Map,mt=0,z=(i(M,g),pt=n(M),e(M,[{key:"option",value:function(t){for(var e=this.getSlide(),e=e?e[t]:void 0,i=arguments.length,n=new Array(1{{ERROR}}

"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this,i=(t.state="loading",t.$el.classList.add("is-loading"),t.$el.querySelector(".fancybox__spinner"));i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",function(){e.Carousel.Panzoom.velocity||e.close()}),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&1