From 5cd5c4d79577a94df013263a76b07dd377cb0e8a Mon Sep 17 00:00:00 2001 From: Samuel Baptista Date: Fri, 24 Aug 2018 17:08:51 +0200 Subject: [PATCH] Update docs --- docs/assets/natural-gallery-js/natural-gallery.full.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/assets/natural-gallery-js/natural-gallery.full.js b/docs/assets/natural-gallery-js/natural-gallery.full.js index 42db372..3e27dc1 100644 --- a/docs/assets/natural-gallery-js/natural-gallery.full.js +++ b/docs/assets/natural-gallery-js/natural-gallery.full.js @@ -1 +1 @@ -(function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define('NaturalGallery',[],t):'object'==typeof exports?exports.NaturalGallery=t():e.NaturalGallery=t()})(this,function(){var e=Math.min,t=Math.max,o=Math.round,i=Math.ceil,n=Math.floor;return function(e){function t(i){if(o[i])return o[i].exports;var n=o[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,i){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var o=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(o,'a',o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=4)}([function(e,t,o){'use strict';var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}();Object.defineProperty(t,'__esModule',{value:!0});var n=o(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.addRows=function(t){this.completeLastRow(),e.prototype.addRows.call(this,t)},t.prototype.endResize=function(){e.prototype.endResize.call(this),this.completeLastRow(),this.flushBufferedItems()},t.prototype.completeLastRow=function(){var e=this;if(this.visibleCollection.length){var t=this.visibleCollection[this.visibleCollection.length-1].row,o=this.visibleCollection.filter(function(e){return e.row===t}).length,n=this.collection.slice(this.visibleCollection.length-o);this.organizeItems(n,n[0].row,n[0].row);var i=n.slice(o).filter(function(e){return e.row<=n[0].row});i.forEach(function(t){return e.addItemToDOM(t)})}},t}(n.AbstractRowGallery);t.AbstractResponsiveRowGallery=l},function(e,t,o){'use strict';var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}();Object.defineProperty(t,'__esModule',{value:!0});var n=o(2),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.onScroll=function(){this.addRows(1)},t.prototype.onPageAdd=function(){this.addRows(this.getRowsPerPage())},t.prototype.addRows=function(e){var t=this,o=this.visibleCollection.length,i=this.visibleCollection.length?this.visibleCollection[o-1].row+1:0,n=i+e-1,l=this.collection.slice(o);this.organizeItems(l,i,n);var a=l.filter(function(e){return e.row<=n});a.forEach(function(e){return t.addItemToDOM(e)}),this.flushBufferedItems(),this.updateNextButtonVisibility()},t.prototype.endResize=function(){e.prototype.endResize.call(this),this.visibleCollection.length&&this.organizeItems(this.visibleCollection)},t}(n.AbstractGallery);t.AbstractRowGallery=l},function(e,t,o){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var i=o(8),l=o(3),a=o(9),s=o(10),r=o(11),d=function(){function e(e,t,o,i){void 0===i&&(i=null),this.elementRef=e,this.userOptions=t,this.photoswipeElementRef=o,this.scrollElementRef=i,this.defaultOptions={gap:3,rowsPerPage:0,showLabels:'hover',lightbox:!1,minRowsAtStart:2,selectable:!1,activable:!1,infiniteScrollOffset:0,photoSwipeOptions:null},this.photoswipeDefaultOptions={bgOpacity:0.85,showHideOpacity:!1},this.old_scroll_top=0,this._collection=[],this._visibleCollection=[],this.photoswipeCollection=[],this.scrollBufferedItems=[],this.requiredItems=0,this.init()}return e.prototype.init=function(){var e=this;this.elementRef.classList.add('natural-gallery-js'),this.flushBufferedItems=r.debounce(function(){e.scrollBufferedItems.forEach(function(t){t.loadImage(),e.dispatchEvent('item-displayed',t.model)}),e.scrollBufferedItems=[],e.requiredItems&&(e.dispatchEvent('pagination',{offset:e.collection.length,limit:e.requiredItems}),e.requiredItems=0)},500,{leading:!1,trailing:!0}),this.defaultsOptions(),this.options.lightbox&&!this.photoswipeElementRef&&console.error('Lightbox option is set to true, but no PhotoSwipe reference is given'),this.render(),this.requestItems(),this.options.rowsPerPage||this.bindScroll(null===this.scrollElementRef?document:this.scrollElementRef)},e.prototype.defaultsOptions=function(){for(var e in this.options=this.userOptions||{},this.defaultOptions)'undefined'==typeof this.options[e]&&(this.options[e]=this.defaultOptions[e])},e.prototype.requestItems=function(){var e=this.getEstimatedItemsPerRow(),t=e*(this.getRowsPerPage()+1);this.dispatchEvent('pagination',{offset:this.collection.length,limit:t})},e.prototype.getRowsPerPage=function(){if(0=e&&t.onScroll()})},e.prototype.openPhotoSwipe=function(e){var t=this;if(this.options.lightbox&&!this.photoswipeElementRef)return void console.error('Lightbox option is set to true, but no PhotoSwipe reference is given');var o={index:this.collection.findIndex(function(t){return t===e}),loop:!1};o=Object.assign({},this.photoswipeDefaultOptions,this.options.photoSwipeOptions,o),console.log('pswpOptions',o),console.log('item',e);var i=new a(this.photoswipeElementRef,s,this.photoswipeCollection,o);i.init(),i.listen('beforeChange',function(e){1===e&&i.getCurrentIndex()===t.visibleCollection.length&&t.onPageAdd()}),this.dispatchEvent('zoom',{item:e.model,photoswipe:i})},e.prototype.getPhotoswipeItem=function(e){return{src:e.model.enlargedSrc,w:e.model.enlargedWidth,h:e.model.enlargedHeight,title:e.title}},e.prototype.dispatchEvent=function(e,t){var o=new CustomEvent(e,{detail:t});this.elementRef.dispatchEvent(o)},e.prototype.selectVisibleItems=function(){this.visibleCollection.forEach(function(e){return e.select()})},e.prototype.unselectAllItems=function(){this.visibleCollection.forEach(function(e){return e.unselect()})},e.prototype.addEventListener=function(e,t){this.elementRef.addEventListener(e,t),'pagination'===e&&this.requestItems()},e.prototype.empty=function(){this.bodyElementRef.innerHTML='',this._visibleCollection=[],this.photoswipeCollection=[],this._collection=[]},e.prototype.clear=function(){this.empty(),this.requestItems()},e.prototype.setItems=function(e){this.empty(),this.addItems(e)},Object.defineProperty(e.prototype,'collection',{get:function(){return this._collection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'visibleCollection',{get:function(){return this._visibleCollection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'width',{get:function(){return n(this.bodyElementRef.getBoundingClientRect().width)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'collectionLength',{get:function(){return this.collection.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'visibleCollectionLength',{get:function(){return this.visibleCollection.length},enumerable:!0,configurable:!0}),e}();t.AbstractGallery=d},function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var o;(function(e){e.getIcon=function(e){var t=document.createElementNS('http://www.w3.org/2000/svg','svg');return t.setAttribute('viewBox','0 0 100 100'),t.innerHTML='',t}})(o=t.Utility||(t.Utility={}))},function(e,t,o){'use strict';Object.defineProperty(t,'__esModule',{value:!0}),o(5),o(6);var i=o(7);t.Natural=i.Natural;var n=o(12);t.Masonry=n.Masonry;var l=o(14);t.ResponsiveSquare=l.ResponsiveSquare;var a=o(15);t.Square=a.Square},function(){},function(){},function(e,t,l){'use strict';var a=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}();Object.defineProperty(t,'__esModule',{value:!0});var s=l(0),r=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultOptions={rowHeight:400,gap:3,rowsPerPage:0,showLabels:'hover',lightbox:!1,minRowsAtStart:2,selectable:!1,activable:!1,infiniteScrollOffset:0,photoSwipeOptions:null},t}return a(t,e),t.prototype.getEstimatedItemsPerRow=function(){return i((this.width+this.options.gap)/(this.options.rowHeight+this.options.gap))},t.prototype.getEstimatedRowsPerPage=function(){return i(this.getGalleryVisibleHeight()/(this.options.rowHeight+this.options.gap))+1},t.prototype.organizeItems=function(e,t,o,i){void 0===t&&(t=0),void 0===o&&(o=null),void 0===i&&(i=null),i||(i=t?t:0);for(var n=1;n<=e.length;n++){var l=e.slice(0,n),a=this.getRowWidth(this.options.rowHeight,this.options.gap,l);if(a>=this.width){this.computeSizes(l,this.width,this.options.gap,i);var s=i+1;(null===o||s<=o)&&this.organizeItems(e.slice(n),t,o,s);break}else if(n===e.length){this.computeSizes(l,null,this.options.gap,i,this.options.rowHeight);break}}},t.prototype.computeSizes=function(e,t,l,a,s){void 0===s&&(s=null);for(var r=t?this.getRowHeight(t,l,e):s,d=this.getRowWidth(r,l,e),p=t?this.apportionExcess(e,t,d):0,c=0,m=0;m]+>/gi,'')},e.prototype.init=function(){var t=this,e=null;this.title&&-1<['always','hover'].indexOf(this.options.showLabels)&&(e=!0);var o=document.createElement('div'),n=document.createElement('div'),l=this.getLinkElement(),a=null,s=null;if(this.options.lightbox&&e&&l?(e=l,e.classList.add('button'),a=n,s=l):this.options.lightbox&&e&&!l?(e=document.createElement('div'),this.options.activable?(s=e,e.classList.add('button'),a=n):a=o):this.options.lightbox&&!e?a=o:!this.options.lightbox&&e&&l?(n=this.getLinkElement(),e=l,e.classList.add('button'),s=o):this.options.lightbox||!e||l?!this.options.lightbox&&!e&&l&&(n=l,s=l):(e=document.createElement('div'),this.options.activable&&(s=o,e.classList.add('button'))),a&&(a.classList.add('zoomable'),a.addEventListener('click',function(){var e=new CustomEvent('zoom',{detail:t});t._element.dispatchEvent(e)})),s&&(s.classList.add('activable'),s.addEventListener('click',function(e){var o=new CustomEvent('activate',{detail:{item:t,clickEvent:e}});t._element.dispatchEvent(o)})),n.classList.add('image'),o.classList.add('figure'),o.appendChild(n),this.model.color&&(o.style.backgroundColor=this.model.color+'11'),this._element=o,this._image=n,e&&(e.textContent=this.title,e.classList.add('title'),'hover'===this.options.showLabels&&e.classList.add('hover'),o.appendChild(e)),this.options.selectable){this._selectBtn=document.createElement('div');var r=i.Utility.getIcon('natural-gallery-icon-select');this._selectBtn.appendChild(r),this._selectBtn.classList.add('selectBtn'),this._selectBtn.addEventListener('click',function(o){o.stopPropagation(),t.toggleSelect();var e=new CustomEvent('select',{detail:t});t._element.dispatchEvent(e)}),this._element.appendChild(this._selectBtn)}return this.style(),o},e.prototype.style=function(){this._element&&(this._element.style.width=this.width+'px',this._element.style.height=this.height+'px',this._element.style.marginBottom=this.options.gap+'px',this._element.style.marginRight=this.last?'0':this.options.gap+'px')},e.prototype.loadImage=function(){var e=this,t=document.createElement('img');t.setAttribute('src',this.model.thumbnailSrc),this._image.style.backgroundImage='url('+this.model.thumbnailSrc+')',t.addEventListener('load',function(){e._element.classList.add('loaded')}),t.addEventListener('error',function(){e._element.classList.add('errored')})},e.prototype.toggleSelect=function(){this._selected?this.unselect():this.select()},e.prototype.select=function(){this._selected=!0,this._element.classList.add('selected')},e.prototype.unselect=function(){this._selected=!1,this._element.classList.remove('selected')},e.prototype.getLinkElement=function(){if(this.model.link){var e=document.createElement('a');return e.setAttribute('href',this.model.link),e.classList.add('link'),this.model.linkTarget&&e.setAttribute('target',this.model.linkTarget),e}return null},e.prototype.remove=function(){this._element.parentNode&&this._element.parentNode.removeChild(this._element)},Object.defineProperty(e.prototype,'last',{get:function(){return this._last},set:function(e){this._last=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'row',{get:function(){return this._row},set:function(e){this._row=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'height',{get:function(){return this._height},set:function(e){this._height=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'width',{get:function(){return this._width},set:function(e){this._width=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'thumbnailWidth',{get:function(){return this.model.thumbnailWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'thumbnailHeight',{get:function(){return this.model.thumbnailHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'selected',{get:function(){return this._selected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,'element',{get:function(){return this._element},enumerable:!0,configurable:!0}),e}();t.Item=n},function(i,n,l){var a,s;(function(e,t){a=t,s='function'==typeof a?a.call(n,l,n,i):a,!(s!==void 0&&(i.exports=s))})(this,function(){'use strict';return function(n,l,i,a){var r=Math.abs,s=Math.PI,d={features:null,bind:function(e,t,o,n){var l=(n?'remove':'add')+'EventListener';t=t.split(' ');for(var a=0;ar&&(l.isOldIOSPhone=!0))}var p=s.match(/Android\s([0-9\.]*)/),c=p?p[1]:0;c=parseFloat(c),1<=c&&(4.4>c&&(l.isOldAndroid=!0),l.androidVersion=c),l.isMobileOpera=/opera mini|opera mobi/i.test(s)}for(var m,u,g=['transform','perspective','animationName'],h=['','webkit','Moz','ms','O'],y=0;4>y;y++){n=h[y];for(var i=0;3>i;i++)m=g[i],u=n+(n?m.charAt(0).toUpperCase()+m.slice(1):m),!l[m]&&u in o&&(l[m]=u);n&&!l.raf&&(n=n.toLowerCase(),l.raf=window[n+'RequestAnimationFrame'],l.raf&&(l.caf=window[n+'CancelAnimationFrame']||window[n+'CancelRequestAnimationFrame']))}if(!l.raf){var a=0;l.raf=function(e){var o=new Date().getTime(),i=t(0,16-(o-a)),n=window.setTimeout(function(){e(o+i)},i);return a=o+i,n},l.caf=function(e){clearTimeout(e)}}return l.svg=!!document.createElementNS&&!!document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect,d.features=l,l}};d.detectFeatures(),d.features.oldIE&&(d.bind=function(e,t,o,n){t=t.split(' ');for(var l,a=(n?'detach':'attach')+'Event',s=function(){o.handleEvent.call(o)},r=0;rt.initialZoomLevel?1:1.33},maxSpreadZoom:1.33,modal:!0,scaleMode:'fit'};d.extend(g,a);var h,y,f,w,b,x,v,_,I,E,C,R,P,S,O,T,L,D,k,A,F,z,M,Z,H,B,N,W,U,G,K,q,V,Y,X,j,$,Q,J,ee,te,oe,ie,ne,le,ae,se,re,de,pe,ce,me,ue,ge,he,ye,fe,xe=function(){return{x:0,y:0}},we=xe(),be=xe(),ve=xe(),_e={},Ie=0,Ee={},Ce=xe(),Re=0,Pe=!0,Se=[],Oe={},Te=!1,Le=function(e,t){d.extend(c,t.publicMethods),Se.push(e)},De=function(e){var t=no();if(e>t-1)return e-t;return 0>e?t+e:e},ke={},Ae=function(e,t){return ke[e]||(ke[e]=[]),ke[e].push(t)},Fe=function(e){var t=ke[e];if(t){var o=Array.prototype.slice.call(arguments);o.shift();for(var n=0;nc.currItem.fitRatio?!Te&&(fo(c.currItem,!1,!0),Te=!0):Te&&(fo(c.currItem),Te=!1)),Ze(pe,ve.x,ve.y,E))},Be=function(e){e.container&&Ze(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Ne=function(e,t){t[z]=R+e+'px, 0px'+P},We=function(e,t){if(!g.loop&&t){var i=w+(Ce.x*Ie-e)/Ce.x,n=o(e-It.x);(0>i&&0=no()-1&&0>n)&&(e=It.x+n*g.mainScrollEndFriction)}It.x=e,Ne(e,b)},Ue=function(e,t){var o=Et[e]-Ee[e];return be[e]+we[e]+o-o*(t/C)},Ge=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Ke=function(e){e.x=o(e.x),e.y=o(e.y)},qe=null,Ve=function(){qe&&(d.unbind(document,'mousemove',Ve),d.addClass(n,'pswp--has_mouse'),g.mouseUsed=!0,Fe('mouseUsed')),qe=setTimeout(function(){qe=null},100)},Ye=function(){d.bind(document,'keydown',c),K.transform&&d.bind(c.scrollWrap,'click',c),g.mouseUsed||d.bind(document,'mousemove',Ve),d.bind(window,'resize scroll orientationchange',c),Fe('bindEvents')},Xe=function(){d.unbind(window,'resize scroll orientationchange',c),d.unbind(window,'scroll',I.scroll),d.unbind(document,'keydown',c),d.unbind(document,'mousemove',Ve),K.transform&&d.unbind(c.scrollWrap,'click',c),J&&d.unbind(window,v,c),clearTimeout(q),Fe('unbindEvents')},je=function(e,t){var o=uo(c.currItem,_e,e);return t&&(de=o),o},$e=function(e){return e||(e=c.currItem),e.initialZoomLevel},Qe=function(e){return e||(e=c.currItem),0t.min[e])?(o[e]=t.min[e],!0):!!(o[e]=n)return at(e),a(i),void(s&&s());a((i-o)*l(r/n)+o),nt[e].raf=H(d)}};d()},pt=30,ct=10,mt={},p={},ut={},gt={},ht={},yt=[],ft={},xt=[],wt={},bt=0,vt=xe(),_t=0,It=xe(),Et=xe(),Ct=xe(),Rt=function(e,t){return e.x===t.x&&e.y===t.y},Pt=function(e,t){return r(e.x-t.x)de.min[e]||sde.min[e]&&(o=g.panEndFriction,a=de.min[e]-s,i=de.min[e]-be[e]),(0>=i||0>p)&&1p&&d>ft.x&&(l=ft.x)):de.min.x!==de.max.x&&(n=s)):(s=i||0c.currItem.fitRatio&&(ve[e]+=t[e]*o))},Gt=function(t){if(!('mousedown'===t.type&&0e&&(e=yt.length),yt[e]={x:t.pageX,y:t.pageY,id:t.pointerId}}var o=Wt(t),i=o.length;le=null,rt(),J&&1!==i||(J=ue=!0,d.bind(window,v,c),j=ye=ge=$=ne=oe=ee=te=!1,me=null,Fe('firstTouchStart',o),Ge(be,ve),we.x=we.y=0,Ge(gt,o[0]),Ge(ht,gt),ft.x=Ce.x*Ie,xt=[{x:gt.x,y:gt.y}],Y=V=ze(),je(E,!0),Ot(),Tt()),ae||!(1=ct&&(me=0c.currItem.initialZoomLevel+c.currItem.initialZoomLevel/15&&(ye=!0);var i=1,n=$e(),l=Qe();if(!(ol&&(i=(o-l)/(6*n),1i&&(i=0),se=t,zt(mt,p,vt),we.x+=vt.x-Ct.x,we.y+=vt.y-Ct.y,Ge(Ct,vt),ve.x=Ue('x',o),ve.y=Ue('y',o),j=o>E,E=o,He()}else{if(!me)return;if(ue&&(ue=!1,r(ut.x)>=ct&&(ut.x-=le[0].x-ht.x),r(ut.y)>=ct&&(ut.y-=le[0].y-ht.y)),gt.x=mt.x,gt.y=mt.y,0===ut.x&&0===ut.y)return;if('v'===me&&g.closeOnVerticalDrag&&!Lt()){we.y+=ut.y,ve.y+=ut.y;var d=Zt();return $=!0,Fe('onVerticalDrag',d),Me(d),void He()}Mt(ze(),mt.x,mt.y),oe=!0,de=c.currItem.bounds;var m=Ut('x',ut);m||(Ut('y',ut),Ke(ve),He())}}},Vt=function(t){if(K.isOldAndroid){if(Q&&'mouseup'===t.type)return;-1a?'zoom':'swipe',ae&&2>l&&(ae=!1,1===l&&(i='zoomPointerUp'),Fe('zoomGestureEnded')),le=null,oe||te||ce||$){if(rt(),X||(X=Yt()),X.calculateSwipeSpeed('x'),$){var s=Zt();if(sc.currItem.fitRatio&&Xt(X)):void Qt()}},Yt=function(){var e,t,i={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(o){1r(i.lastFlickSpeed[o])&&(i.lastFlickSpeed[o]=0),i.slowDownRatio[o]=0.95,i.slowDownRatioReverse[o]=1-i.slowDownRatio[o],i.speedDecelerationRatio[o]=1},calculateOverBoundsAnimOffset:function(e,t){i.backAnimStarted[e]||(ve[e]>de.min[e]?i.backAnimDestination[e]=de.min[e]:ve[e]i.speedDecelerationRatioAbs[e]&&(i.lastFlickSpeed[e]=0,i.backAnimStarted[e]=!0,dt('bounceZoomPan'+e,ve[e],i.backAnimDestination[e],t||300,d.easing.sine.out,function(t){ve[e]=t,He()}))))},calculateAnimOffset:function(e){i.backAnimStarted[e]||(i.speedDecelerationRatio[e]*=i.slowDownRatio[e]+i.slowDownRatioReverse[e]-i.slowDownRatioReverse[e]*i.timeDiff/10,i.speedDecelerationRatioAbs[e]=r(i.lastFlickSpeed[e]*i.speedDecelerationRatio[e]),i.distanceOffset[e]=i.lastFlickSpeed[e]*i.speedDecelerationRatio[e]*i.timeDiff,ve[e]+=i.distanceOffset[e])},panAnimLoop:function(){if(nt.zoomPan&&(nt.zoomPan.raf=H(i.panAnimLoop),i.now=ze(),i.timeDiff=i.now-i.lastNow,i.lastNow=i.now,i.calculateAnimOffset('x'),i.calculateAnimOffset('y'),He(),i.calculateOverBoundsAnimOffset('x'),i.calculateOverBoundsAnimOffset('y'),0.05>i.speedDecelerationRatioAbs.x&&0.05>i.speedDecelerationRatioAbs.y))return ve.x=o(ve.x),ve.y=o(ve.y),He(),void at('zoomPan')}};return i},Xt=function(e){return e.calculateSwipeSpeed('y'),de=c.currItem.bounds,e.backAnimDestination={},e.backAnimStarted={},0.05>=r(e.lastFlickSpeed.x)&&0.05>=r(e.lastFlickSpeed.y)?(e.speedDecelerationRatioAbs.x=e.speedDecelerationRatioAbs.y=0,e.calculateOverBoundsAnimOffset('x'),e.calculateOverBoundsAnimOffset('y'),!0):void(st('zoomPan'),e.lastNow=ze(),e.panAnimLoop())},jt=function(o,i){var n;ce||(bt=w);var l;if('swipe'===o){var a=gt.x-ht.x,s=10>i.lastFlickDist.x;a>pt&&(s||20i.lastFlickOffset.x)&&(l=1)}var p;l&&(w+=l,0>w?(w=g.loop?no()-1:0,p=!0):w>=no()&&(w=g.loop?0:no()-1,p=!0),(!p||g.loop)&&(Re+=l,Ie-=l,n=!0));var m,u=Ce.x*Ie,h=r(u-It.x);return n||u>It.x==0o&&(e=o);var i,n=he;return ge&&!j&&!ye&&EThe image could not be loaded.',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return eo.length}},co=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},mo=function(e,t,i){var n=e.bounds;n.center.x=o((so.x-t)/2),n.center.y=o((so.y-i)/2)+e.vGap.top,n.max.x=t>so.x?o(so.x-t):n.center.x,n.max.y=i>so.y?o(so.y-i)+e.vGap.top:n.center.y,n.min.x=t>so.x?0:n.center.x,n.min.y=i>so.y?e.vGap.top:n.center.y},uo=function(e,t,o){if(e.src&&!e.loadError){var i=!o;if(i&&(!e.vGap&&(e.vGap={top:0,bottom:0}),Fe('parseVerticalMargin',e)),so.x=t.x,so.y=t.y-e.vGap.top-e.vGap.bottom,i){var n=so.x/e.w,l=so.y/e.h;e.fitRatio=nno()&&(g.loop=!1),Ae('beforeChange',function(t){var o,i=g.preload,n=!(null!==t)||0<=t,l=e(i[0],no()),a=e(i[1],no());for(o=1;o<=(n?a:l);o++)c.lazyLoadItem(w+o);for(o=1;o<=(n?l:a);o++)c.lazyLoadItem(w-o)}),Ae('initialLayout',function(){c.currItem.initialLayout=g.getThumbBoundsFn&&g.getThumbBoundsFn(w)}),Ae('mainScrollAnimComplete',xo),Ae('initialZoomInEnd',xo),Ae('destroy',function(){for(var e,t=0;tE?d.addClass(n,'pswp--zoom-allowed'):d.removeClass(n,'pswp--zoom-allowed'),l()},l=function(){o&&(d.removeClass(n,'pswp--dragging'),o=!1)};Ae('resize',i),Ae('afterChange',i),Ae('pointerDown',function(){c.mouseZoomedIn&&(o=!0,d.addClass(n,'pswp--dragging'))}),Ae('pointerUp',l),e||i()},handleMouseWheel:function(t){if(E<=c.currItem.fitRatio)return g.modal&&(!g.closeOnScroll||lt||J?t.preventDefault():z&&2=de.max.x&&o<=de.min.y&&o>=de.max.y)&&t.preventDefault(),c.panTo(e,o)},toggleDesktopZoom:function(e){e=e||{x:_e.x/2+Ee.x,y:_e.y/2+Ee.y};var t=g.getDoubleTapZoom(!0,c.currItem),o=E===t;c.mouseZoomedIn=!o,c.zoomTo(o?c.currItem.initialZoomLevel:t,e,333),d[(o?'remove':'add')+'Class'](n,'pswp--zoomed-in')}}});var Io,Eo,Co,Ro,Po,So,Oo,To,Lo,Do,ko,Ao,Fo={history:!0,galleryUID:1},zo=function(){return ko.hash.substring(1)},Mo=function(){Io&&clearTimeout(Io),Co&&clearTimeout(Co)},Zo=function(){var e=zo(),t={};if(5>e.length)return t;var o,i=e.split('&');for(o=0;on.length||(t[n[0]]=n[1])}if(g.galleryPIDs){var l=t.pid;for(t.pid=0,o=0;ot.pid&&(t.pid=0),t},Ho=function(){if(Co&&clearTimeout(Co),lt||J)return void(Co=setTimeout(Ho,500));Ro?clearTimeout(Eo):Ro=!0;var e=w+1,t=io(w);t.hasOwnProperty('pid')&&(e=t.pid);var o=Oo+'&gid='+g.galleryUID+'&pid='+e;To||-1!==ko.hash.indexOf(o)||(Do=!0);var i=ko.href.split('#')[0]+'#'+o;Ao?'#'+o!==window.location.hash&&history[To?'replaceState':'pushState']('',document.title,i):To?ko.replace(i):ko.hash=o,To=!0,Eo=setTimeout(function(){Ro=!1},60)};Le('History',{publicMethods:{initHistory:function(){if(d.extend(g,Fo,!0),!!g.history){ko=window.location,Do=!1,Lo=!1,To=!1,Oo=zo(),Ao='pushState'in history,-1w||w>=no())&&(w=0),c.currItem=io(w),(K.isOldIOSPhone||K.isOldAndroid)&&(Pe=!1),n.setAttribute('aria-hidden','false'),g.modal&&(Pe?n.style.position='fixed':(n.style.position='absolute',n.style.top=d.getScrollY()+'px')),void 0===G&&(Fe('initialLayout'),G=W=d.getScrollY());var i='pswp--open ';for(g.mainClass&&(i+=g.mainClass+' '),g.showHideOpacity&&(i+='pswp--animate_opacity '),i+=Z?'pswp--touch':'pswp--notouch',i+=K.animationName?' pswp--css_animation':'',i+=K.svg?' pswp--svg':'',d.addClass(n,i),c.updateSize(),x=-1,Re=null,e=0;ede.min.x?e=de.min.x:ede.min.y?t=de.min.y:to)){c.currItem=io(w),Te=!1,Fe('beforeChange',Re),o>=u&&(x+=Re+(0f.fitControlsWidth},S=function(e,t,o){n[(o?'add':'remove')+'Class'](e,'pswp__'+t)},O=function(){var e=1===f.getNumItemsFn();e!==y&&(S(l,'ui--one-slide',e),y=e)},T=function(){S(d,'share-modal--hidden',E)},L=function(){return E=!E,E?(n.removeClass(d,'pswp__share-modal--fade-in'),setTimeout(function(){E&&T()},300)):(T(),setTimeout(function(){E||n.addClass(d,'pswp__share-modal--fade-in')},30)),E||k(),!1},D=function(i){i=i||window.event;var e=i.target||i.srcElement;return(t.shout('shareLinkClick',i,e),!!e.href)&&(!!e.hasAttribute('download')||(window.open(e.href,'pswp_share','scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left='+(window.screen?o(screen.width/2-275):100)),E||L(),!1))},k=function(){for(var e,t,o,n,l,a='',s=0;s