1&&(a=1);let r=e(a);t(r),a<1&&requestAnimationFrame(s)})}function _(e){if(!e)return!1;y=!0,r=e,h=!1,w=!1,S=e.getAttribute("data-maxwidth")||e.settings.maxWidth,C=e.getAttribute("data-overlay")||e.settings.overlayColor,E=e.getAttribute("data-ratio")||e.settings.ratio,q=e.getAttribute("data-autoplay")||e.settings.autoplay,M=e.getAttribute("data-href")||e.getAttribute("href"),P=e.getAttribute(e.settings.titleattr)||""}function G(){return!(!r||!document.body.classList.contains("vbox-open"))&&((!r.settings.onPreClose||"function"!=typeof r.settings.onPreClose||(r.settings.onPreClose(r,p,j,H),!1!==r.settings.onPreClose))&&(document.body.removeEventListener("keydown",te),document.body.classList.remove("vbox-open"),r.focus(),void U({duration:200,timing:K,draw:function(e){k.style.opacity=1-e,1===e&&k.remove()}})))}function J(){ve(j)}function ee(){ve(H)}function te(e){27===e.keyCode&&G(),O||(37==e.keyCode&&!0===w&&ve(H),39==e.keyCode&&!0===h&&ve(j),O=setTimeout(()=>{O=null},100))}function oe(e){a.classList.contains("vbox-"+e)||function(){y=!1,a.style.opacity=0,a.innerHTML=x;let e=a.querySelector(":first-child");e.classList.add("vbox-child"),e.style.padding=r.settings.border,e.style.backgroundColor=r.settings.bgcolor,e.style.maxWidth=S,e.style.transform="scale(0.9)",e.style.transition="transform 200ms";let t=a.querySelector(".vbox-child img");t&&t.addEventListener("dragstart",function(e){e.preventDefault()}),i.scrollTo(0,0),e.style.transform="scale(1)",U({duration:200,timing:K,draw:function(e){a.style.opacity=e,1===e&&u.classList.add("vbox-hidden")}}),r.settings.onContentLoaded&&"function"==typeof r.settings.onContentLoaded&&r.settings.onContentLoaded(x)}()}function ne(e,t,o){let n;if(a.classList.add("vbox-loading"),-1!==e.search(/.+\.mp4|og[gv]|webm/))x='";else{let s,i=function(e){let t;return e.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),RegExp.$3.indexOf("youtu")>-1?t="youtube":RegExp.$3.indexOf("vimeo")>-1&&(t="vimeo"),{type:t,id:RegExp.$6}}(e),a=(n=o?"?rel=0&autoplay=1":"?rel=0")+function(e){let t="",o=decodeURIComponent(e).split("?");if(void 0!==o[1]){let e,n,s=o[1].split("&");for(n=0;n'}a.classList.remove("vbox-loading"),oe("animated")}function se(){var e;if(e=x,R.innerHTML=e,(g=R.querySelectorAll("img")).length){let e=0;F(g,function(t){let o=t.src;(X=new Image).onload=function(){++e==g.length&&(a.classList.remove("vbox-loading"),oe("animated"))},X.onerror=function(){++e==g.length&&(a.classList.remove("vbox-loading"),oe("animated"))},X.src=o})}else a.classList.remove("vbox-loading"),oe("animated")}function ie(e){if(!y){let t=.84*r.settings.navSpeed;a.style.transition="margin "+t+"ms ease-out, opacity "+t+"ms ease-out",A=v=e.pageY,D=Q=e.pageX,W=!0}}function ae(e){if(W){W=!1;let e=r,t=!1;(N=Q-D)<0&&h&&(e=j,t=!0),N>0&&w&&(e=H,t=!0),Math.abs(N)>=Z&&t?ve(e):(a.style.marginLeft=0,a.style.opacity=1)}}function re(e){if(W&&!y){Q=e.pageX,v=e.pageY,d=Q-D,c=v-A;let t=Math.abs(d);if(t>Math.abs(c)&&t<=180){let o=1.5*(1-t/180);e.preventDefault(),a.style.marginLeft=d+"px",a.style.opacity=o}}}function le(e){if(!e)return!1;T=e.dataset.gall,L=e.settings.numeration,f=e.settings.infinigall,o.innerHTML="";let s=e.dataset.vbtype;e.settings.share&&"iframe"!==s&&"inline"!==s&&"ajax"!==s&&function(e){if(navigator.canShare){const t={url:e};o.insertAdjacentHTML("beforeend",''+I+"
"),o.querySelector(".vbox-share-mobile").addEventListener("click",function(e){e.preventDefault(),navigator.share(t)})}o.insertAdjacentHTML("beforeend",''+B+""),o.insertAdjacentHTML("beforeend",'"),o.querySelector(".vbox-share-copy").addEventListener("click",function(t){t.preventDefault();let o=document.getElementById("myTooltip");navigator.clipboard.writeText(e).then(function(){o.innerHTML='Copied
'},function(){console.log("copy failed")})})}(e.href),m=document.querySelectorAll('.vbox-item[data-gall="'+T+'"]'),l=Array.prototype.indexOf.call(m,e),m.length<2&&(f=!1,L=!1),j=m[l+1],H=m[l-1],!j&&f&&(j=m[0]),!H&&f&&(H=m[m.length-1]),m.length>=1?(p=l+1,t.innerHTML=p+" / "+m.length):p=1,L?t.classList.remove("vbox-hidden"):t.classList.add("vbox-hidden"),""!==P?n.classList.remove("vbox-hidden"):n.classList.add("vbox-hidden"),n.innerHTML=P,w=!1,h=!1,(j||f)&&(h=!0),(l>0||f)&&(w=!0),(w||h)&&e.settings.navTouch?(a.classList.add("vbox-grab"),a.addEventListener("touchstart",ie,!1),a.addEventListener("touchend",ae,!1),a.addEventListener("touchmove",re,!1),a.addEventListener("mousedown",ie,!1),a.addEventListener("mouseup",ae,!1),a.addEventListener("mouseout",ae,!1),a.addEventListener("mousemove",re,!1)):(a.classList.remove("vbox-grab"),a.removeEventListener("touchstart",ie,!1),a.removeEventListener("touchend",ae,!1),a.removeEventListener("touchmove",re,!1),a.removeEventListener("mousedown",ie,!1),a.removeEventListener("mouseup",ae,!1),a.removeEventListener("mouseout",ae,!1),a.removeEventListener("mousemove",re,!1));let i=k.querySelector(".vbox-next"),r=k.querySelector(".vbox-prev");w?r.classList.remove("vbox-hidden"):r.classList.add("vbox-hidden"),h?i.classList.remove("vbox-hidden"):i.classList.add("vbox-hidden"),e.settings.navigation||(i.classList.add("vbox-hidden"),r.classList.add("vbox-hidden"))}function de(t){e.style.backgroundColor=C,b.innerHTML=function(e){if(!e)return"Loading...";let t='',o=0;for(o=0;o
';return t+=""}(Y[t.settings.spinner]),k.style.setProperty("--sk-color",t.settings.spinColor),u.classList.remove("vbox-hidden"),o.classList.remove("vbox-top","vbox-bottom"),n.classList.remove("vbox-top","vbox-bottom"),"top"==t.settings.titlePosition?(n.classList.add("vbox-top"),o.classList.add("vbox-bottom")):(n.classList.add("vbox-bottom"),o.classList.add("vbox-top"));let s="bar"===t.settings.titleStyle?"100%":"auto",i="pill"===t.settings.titleStyle?"5em":"0",a="bar"===t.settings.shareStyle?"100%":"auto",r="pill"===t.settings.shareStyle?"5em":"0",l="transparent"===t.settings.titleStyle?"transparent":t.settings.toolsBackground,d="transparent"===t.settings.shareStyle?"transparent":t.settings.toolsBackground;k.style.setProperty("--vbox-title-width",s),k.style.setProperty("--vbox-title-radius",i),k.style.setProperty("--vbox-share-width",a),k.style.setProperty("--vbox-share-radius",r),k.style.setProperty("--vbox-tools-color",t.settings.toolsColor),k.style.setProperty("--vbox-title-background",l),k.style.setProperty("--vbox-share-background",d)}function ce(){if(!r)return!1;switch(r.dataset.vbtype){case"iframe":e=M,t=E,a.classList.add("vbox-loading"),x='',a.classList.remove("vbox-loading"),oe("animated");break;case"inline":!function(e){let t=document.querySelector(e);t&&(a.classList.add("vbox-loading"),x=''+t.innerHTML+"
",a.classList.remove("vbox-loading"),oe("animated"))}(M);break;case"ajax":!function(e){a.classList.add("vbox-loading");let t=new XMLHttpRequest;t.open("GET",e,!0),t.onload=function(){x=''+t.response+"
",se()},t.onerror=function(){x='',a.classList.remove("vbox-loading"),oe("animated")},t.send()}(M);break;case"video":ne(M,E,q);break;default:!function(e){X.onload=function(){x='',a.classList.remove("vbox-loading"),oe("animated")},X.src=e}(M)}var e,t}function ve(e){if(!e||y||!document.body.classList.contains("vbox-open"))return!1;_(e),de(e);let t=.84*r.settings.navSpeed;a.style.transition="margin "+t+"ms ease-out, opacity "+t+"ms ease-out",e===H&&a.classList.add("swipe-right"),e===j&&a.classList.add("swipe-left"),u.classList.remove("vbox-hidden");let o=a.style.opacity;a.classList.add("vbox-animated","vbox-loading"),le(e),U({duration:r.settings.navSpeed,timing:K,draw:function(e){a.style.opacity=o-e/o,1===e&&(a.classList.remove("swipe-left","swipe-right","vbox-animated"),a.style.marginLeft=0,a.style.transition="",oe("loading"),y=!1,r.settings.onNavComplete&&"function"==typeof r.settings.onNavComplete&&r.settings.onNavComplete(r,p,j,H))}}),ce()}function ue(l){return!(document.body.classList.contains("vbox-open")||!l)&&(l.settings.onPreOpen&&"function"==typeof l.settings.onPreOpen&&l.settings.onPreOpen(l),!!l.settings.onPreOpen&&(_(l),document.body.insertAdjacentHTML("beforeend",s),document.body.classList.add("vbox-open"),k=document.querySelector(".vbox-overlay"),e=k.querySelector(".vbox-backdrop"),i=k.querySelector(".vbox-container"),a=i.querySelector(".vbox-content"),t=k.querySelector(".vbox-num"),o=k.querySelector(".vbox-share"),n=k.querySelector(".vbox-title"),u=k.querySelector(".vbox-preloader"),b=u.querySelector(".vbox-preloader-inner"),k.style.opacity=0,de(l),le(l),a.classList.add("vbox-animated","vbox-loading"),U({duration:200,timing:K,draw:function(e){k.style.opacity=e,1===e&&(a.classList.remove("vbox-animated"),y=!1,oe("loading"),r.settings.onPostOpen&&"function"==typeof r.settings.onPostOpen&&r.settings.onPostOpen(r,p,j,H))}}),ce(),l.settings.navKeyboard&&(document.body.addEventListener("keydown",te),document.body.addEventListener("keyup",()=>{O&&(clearTimeout(O),O=null)})),document.querySelector(".vbox-prev").addEventListener("click",function(){ve(H)}),document.querySelector(".vbox-next").addEventListener("click",function(){ve(j)}),void k.addEventListener("click",function(e){let t=document.querySelector(".vbox-close");t&&(t.contains(e.target)||t===e.target||r.settings.overlayClose&&e.target.classList.contains("vbox-overlay")||e.target.classList.contains("vbox-content")||e.target.classList.contains("vbox-backdrop")||e.target.classList.contains("vbox-close")||e.target.classList.contains("vbox-preloader")||e.target.classList.contains("vbox-container"))&&G()})))}const be=function(e){const t={};let o=function(e,t){let o={};return F(e,function(t,n){o[n]=e[n]}),F(t,function(e,n){o[n]=t[n]}),o}($,e||{});return t.close=G,t.next=J,t.prev=ee,t.open=ue,t.settings=o,function(e,t){t.onInit&&"function"==typeof t.onInit&&t.onInit(e);let o=t.jQuerySelectors||document.querySelectorAll(t.selector);if(s='',F(o,function(e){if(e.classList.contains("vbox-item"))return!0;e.settings=t,e.classList.add("vbox-item"),e.addEventListener("click",function(t){return t.preventDefault(),e.blur(),ue(e),!1})}),t.popup){let e=document.querySelector(t.popup);e.settings=t,ue(e)}}(t,o),t};return"function"==typeof jQuery&&jQuery.fn.extend({venobox:function(e){const t=e||{};t.jQuerySelectors=this,new be({pluginoptions:t})}}),be});