You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
42 KiB

/*!
* ____ __ ______ __________ _ _____________ ____________
* / __ \/ / / / __ \/_ __/ __ \ | / / _/ ____/ | / / ____/ __ \
* / /_/ / /_/ / / / / / / / / / / | / // // __/ | | /| / / __/ / /_/ /
* / ____/ __ / /_/ / / / / /_/ /| |/ // // /___ | |/ |/ / /___/ _, _/
* /_/ /_/ /_/\____/ /_/ \____/ |___/___/_____/ |__/|__/_____/_/ |_|
*
* photoviewer - v3.7.1
* A JS plugin to view images just like in Windows.
* https://nzbin.github.io/photoviewer/
*
* Copyright (c) 2018 nzbin
* Released under MIT License
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).photoviewer=e()}(this,function(){"use strict";function D(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);i=i.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(o.key),o)}}var w=function(t,e){return new w.fn.init(t,e)},y=window.document,o=[],S=o.concat,A=o.filter,b=o.slice,O={},F={},j={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},B=/^\s*<(\w+|!)[^>]*>/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,X=/^(?:body|html)$/i,W=["val","css","html","text","data","width","height","offset"],t=y.createElement("table"),e=y.createElement("tr"),q={tr:y.createElement("tbody"),tbody:t,thead:t,tfoot:t,td:e,th:e,"*":y.createElement("div")},Z=/^[\w-]*$/,U={},K=U.toString,Q=y.createElement("div"),l=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},x=y.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e=e&&e.parentNode;)if(e===t)return!0;return!1};function h(t){return null==t?String(t):U[K.call(t)]||"object"}function c(t){return"function"==h(t)}function n(t){return null!=t&&t==t.window}function G(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function s(t){return"object"==h(t)}function u(t){return s(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function J(t){var e=!!t&&"length"in t&&t.length,i=h(t);return"function"!=i&&!n(t)&&("array"==i||0===e||"number"==typeof e&&0<e&&e-1 in t)}function r(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function tt(t,e){return"number"!=typeof e||j[r(t)]?e:e+"px"}function et(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})}function it(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function d(t){return t instanceof w}function a(t,e,i,o){return c(e)?e.call(t,i,o):e}function ot(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)}function f(t,e){var i=t.className||"",o=i&&void 0!==i.baseVal;if(void 0===e)return o?i.baseVal:i;o?i.baseVal=e:t.className=e}function nt(t,e){var i={width:["padding-left","padding-right","border-left-width","border-right-width"],height:["padding-top","padding-bottom","border-top-width","border-bottom-width"]};return"border-box"!==t.css("box-sizing")||0<window.navigator.userAgent.indexOf("MSIE ")||navigator.userAgent.match(/Trident.*rv:11\./)?parseFloat(t.css(e)):parseFloat(t.css(e))-parseFloat(t.css(i[e][0]))-parseFloat(t.css(i[e][1]))-parseFloat(t.css(i[e][2]))-parseFloat(t.css(i[e][3]))}function st(e,i){var t=e.replace(/./,function(t){return t[0].toUpperCase()}),o=this[0];return void 0===i?n(o)?o.document.documentElement["client"+t]:G(o)?o.documentElement["scroll"+t]:nt(this,e):this.each(function(t){(o=w(this)).css(e,a(this,i,t,o[e]()))})}w.fn=w.prototype={constuctor:w,length:0,forEach:o.forEach,reduce:o.reduce,push:o.push,sort:o.sort,splice:o.splice,indexOf:o.indexOf,init:function(t,e){var i,o;if(!t)return this;if("string"==typeof t)if("<"==(t=t.trim())[0]&&B.test(t))i=w.fragment(t,RegExp.$1,e),t=null;else{if(void 0!==e)return w(e).find(t);i=w.qsa(y,t)}else{if(c(t))return w(y).ready(t);if(d(t))return t;if(l(t))o=t,i=A.call(o,function(t){return null!=t});else if(s(t))i=[t],t=null;else{if(void 0!==e)return w(e).find(t);i=w.qsa(y,t)}}return w.makeArray(i,t,this)},concat:function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=d(t=arguments[i])?t.toArray():t;return S.apply(d(this)?this.toArray():this,e)},pluck:function(e){return w.map(this,function(t){return t[e]})},toArray:function(){return this.get()},get:function(t){return void 0===t?b.call(this):this[0<=t?t:t+this.length]},size:function(){return this.length},each:function(i){return o.every.call(this,function(t,e){return!1!==i.call(t,e,t)}),this},map:function(i){return w(w.map(this,function(t,e){return i.call(t,e,t)}))},slice:function(){return w(b.apply(this,arguments))},first:function(){var t=this[0];return t&&!s(t)?t:w(t)},last:function(){var t=this[this.length-1];return t&&!s(t)?t:w(t)},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)}},w.extend=w.fn.extend=function(){var t,e,i,o,n,s=arguments[0]||{},a=1,r=arguments.length,h=!1;for("boolean"==typeof s&&(h=s,s=arguments[a]||{},a++),"object"==typeof s||c(s)||(s={}),a===r&&(s=this,a--);a<r;a++)if(null!=(t=arguments[a]))for(e in t)n=s[e],s!==(i=t[e])&&(h&&i&&(u(i)||(o=l(i)))?(n=o?(o=!1,n&&l(n)?n:[]):n&&u(n)?n:{},s[e]=w.extend(h,n,i)):void 0!==i&&(s[e]=i));return s},w.extend({makeArray:function(t,e,i){for(var o=t?t.length:0,n=0;n<o;n++)i[n]=t[n];return i.length=o,i.selector=e||"",i},qsa:function(t,e){var i,o="#"==e[0],n=!o&&"."==e[0],s=o||n?e.slice(1):e,a=Z.test(s);return t.getElementById&&a&&o?(i=t.getElementById(s))?[i]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:b.call(a&&!o&&t.getElementsByClassName?n?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},fragment:function(t,e,i){var o,n,s;return(o=N.test(t)?w(y.createElement(RegExp.$1)):o)||(t.replace&&(t=t.replace(Y,"<$1></$2>")),void 0===e&&(e=B.test(t)&&RegExp.$1),(s=q[e=e in q?e:"*"]).innerHTML=""+t,o=w.each(b.call(s.childNodes),function(){s.removeChild(this)})),u(i)&&(n=w(o),w.each(i,function(t,e){-1<W.indexOf(t)?n[t](e):n.attr(t,e)})),o},matches:function(t,e){var i,o;return!(!e||!t||1!==t.nodeType)&&((i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector)?i.call(t,e):((o=!(i=t.parentNode))&&(i=Q).appendChild(t),i=~w.qsa(i,e).indexOf(t),o&&Q.removeChild(t),i))},each:function(t,e){var i,o;if(J(t)){for(i=0;i<t.length;i++)if(!1===e.call(t[i],i,t[i]))return t}else for(o in t)if(!1===e.call(t[o],o,t[o]))return t;return t},map:function(t,e){var i,o,n,s,a=[];if(J(t))for(o=0;o<t.length;o++)null!=(i=e(t[o],o))&&a.push(i);else for(n in t)null!=(i=e(t[n],n))&&a.push(i);return 0<(s=a).length?w.fn.concat.apply([],s):s}}),w.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){U["[object "+e+"]"]=e.toLowerCase()}),w.fn.init.prototype=w.fn;var at=function(t,e){e(t);for(var i=0,o=t.childNodes.length;i<o;i++)at(t.childNodes[i],e)};var rt=1;function z(t){return t._zid||(t._zid=rt++)}function $(t){return"string"==typeof t}function ht(){return!0}function lt(){return!1}var ct={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function ut(o,n){if(n||!o.isDefaultPrevented){n=n||o,w.each(ct,function(t,e){var i=n[t];o[t]=function(){return this[e]=ht,i&&i.apply(n,arguments)},o[e]=lt});try{o.timeStamp||(o.timeStamp=Date.now())}catch(t){console.warn(t)}(void 0!==n.defaultPrevented?n.defaultPrevented:"returnValue"in n?!1===n.returnValue:n.getPreventDefault&&n.getPreventDefault())&&(o.isDefaultPrevented=ht)}return o}var M={},dt="onfocusin"in window,ft={focus:"focusin",blur:"focusout"},pt={mouseenter:"mouseover",mouseleave:"mouseout"},gt=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/;function mt(t){t=(""+t).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function vt(t,e,i,o){var n,s;return(e=mt(e)).ns&&(s=e.ns,n=new RegExp("(?:^| )"+s.replace(" "," .* ?")+"(?: |$)")),(M[z(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||n.test(t.ns))&&(!i||z(t.fn)===z(i))&&(!o||t.sel==o)})}function wt(t,e){return t.del&&!dt&&t.e in ft||!!e}function yt(t){return pt[t]||dt&&ft[t]||t}function bt(e,t,i,o,n){var s=z(e);(t||"").split(/\s/).forEach(function(t){vt(e,t,i,o).forEach(function(t){delete M[s][t.i],"removeEventListener"in e&&e.removeEventListener(yt(t.e),t.proxy,wt(t,n))})})}var i,p="",g=y.createElement("div"),t=g.style.transitionProperty;function xt(t){return i?i+t:t.toLowerCase()}void 0===g.style.transform&&w.each({Webkit:"webkit",Moz:"",O:"o"},function(t,e){if(void 0!==g.style[t+"TransitionProperty"])return p="-"+t.toLowerCase()+"-",i=e,!1}),g=null,w.fx={off:void 0===i&&void 0===t,speeds:{_default:400,fast:200,slow:600},cssPrefix:p,transitionEnd:xt("TransitionEnd"),animationEnd:xt("AnimationEnd")};var zt,$t,Mt,Tt,Ct,Lt,Dt,Ht,kt,Vt=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,m={};zt=p+"transform",m[$t=p+"transition-property"]=m[Mt=p+"transition-duration"]=m[Ct=p+"transition-delay"]=m[Tt=p+"transition-timing-function"]=m[Lt=p+"animation-name"]=m[Dt=p+"animation-duration"]=m[kt=p+"animation-delay"]=m[Ht=p+"animation-timing-function"]="";function Et(){return this.each(function(){var t,e,i;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(t=this.nodeName,O[t]||(e=y.createElement(t),y.body.appendChild(e),i=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),O[t]=i="none"==i?"block":i),O[t]))})}var Pt=function(){return this.css("display","none")};function It(t,e,i,o,n){"function"!=typeof e||n||(n=e,e=void 0);i={opacity:i};return o&&(i.scale=o,t.css(w.fx.cssPrefix+"transform-origin","0 0")),t.animate(i,e,null,n)}var H=w,e={find:function(t){var i=this,e=t?"object"==typeof t?w(t).filter(function(){var e=this;return o.some.call(i,function(t){return x(t,e)})}):1==this.length?w(w.qsa(this[0],t)):this.map(function(){return w.qsa(this,t)}):w();return e},closest:function(i,o){var n=[],s="object"==typeof i&&w(i);return this.each(function(t,e){for(;e&&!(s?0<=s.indexOf(e):w.matches(e,i));)e=e!==o&&!G(e)&&e.parentNode;e&&n.indexOf(e)<0&&n.push(e)}),w(n)},css:function(t,e){if(arguments.length<2){var i,o,n=this[0];if("string"==typeof t)return n?n.style[et(t)]||getComputedStyle(n,"").getPropertyValue(t):void 0;if(l(t))return n?(i={},o=getComputedStyle(n,""),w.each(t,function(t,e){i[e]=n.style[et(e)]||o.getPropertyValue(e)}),i):void 0}var s="";if("string"==h(t))e||0===e?s=r(t)+":"+tt(t,e):this.each(function(){this.style.removeProperty(r(t))});else for(var a in t)t[a]||0===t[a]?s+=r(a)+":"+tt(a,t[a])+";":this.each(function(){this.style.removeProperty(r(a))});return this.each(function(){this.style.cssText+=";"+s})},addClass:function(i){var o=[];return i?this.each(function(t){var e;"className"in this&&(o=[],e=f(this),a(this,i,t,e).split(/\s+/g).forEach(function(t){w(this).hasClass(t)||o.push(t)},this),o.length)&&f(this,e+(e?" ":"")+o.join(" "))}):this},hasClass:function(t){return!!t&&o.some.call(this,function(t){return this.test(f(t))},it(t))},removeClass:function(e){var i=[];return this.each(function(t){if("className"in this){if(void 0===e)return f(this,"");i=f(this),a(this,e,t,i).split(/\s+/g).forEach(function(t){i=i.replace(it(t)," ")}),f(this,i.trim())}})},attr:function(i,o){var t;return"string"!=typeof i||1 in arguments?this.each(function(t){if(1===this.nodeType)if(s(i))for(var e in i)ot(this,e,i[e]);else ot(this,i,a(this,o,t,this.getAttribute(i)))}):0 in this&&1==this[0].nodeType&&null!=(t=this[0].getAttribute(i))?t:void 0},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){ot(this,t)},this)})},append:function(){return t=this,e=arguments,o=function(t){this.insertBefore(t,null)},n=!0,a=w.map(e,function(t){var e=[];return"array"==(i=h(t))?(t.forEach(function(t){return void 0!==t.nodeType?e.push(t):d(t)?e=e.concat(t.get()):void(e=e.concat(w.fragment(t)))}),e):"object"==i||null==t?t:w.fragment(t)}),r=1<t.length,a.length<1?t:t.each(function(t,e){s=n?e:e.parentNode;var i=x(y.documentElement,s);a.forEach(function(t){if(r)t=t.cloneNode(!0);else if(!s)return w(t).remove();o.call(e,t),i&&at(t,function(t){var e;null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||(e=t.ownerDocument?t.ownerDocument.defaultView:window).eval.call(e,t.innerHTML)})})});var t,e,o,n,i,s,a,r},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},empty:function(){return this.each(function(){this.innerHTML=""})},html:function(i){return 0 in arguments?this.each(function(t){var e=this.innerHTML;w(this).empty().append(a(this,i,t,e))}):0 in this?this[0].innerHTML:null},width:function(t){return st.call(this,"width",t)},height:function(t){return st.call(this,"height",t)},scrollTop:function(t){var e;if(this.length)return e="scrollTop"in this[0],void 0===t?e?this[0].scrollTop:(n(this[0])?this[0]:this[0].defaultView).pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})},scrollLeft:function(t){var e;if(this.length)return e="scrollLeft"in this[0],void 0===t?e?this[0].scrollLeft:(n(this[0])?this[0]:this[0].defaultView).pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})},offset:function(o){var t;return o?this.each(function(t){var e=w(this),t=a(this,o,t,e.offset()),i=e.offsetParent().offset(),t={top:t.top-i.top,left:t.left-i.left};"static"==e.css("position")&&(t.position="relative"),e.css(t)}):this.length?y.documentElement===this[0]||x(y.documentElement,this[0])?{left:(t=this[0].getBoundingClientRect()).left+window.pageXOffset,top:t.top+window.pageYOffset,width:Math.round(t.width),height:Math.round(t.height)}:{top:0,left:0}:null},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||y.body;t&&!X.test(t.nodeName)&&"static"==w(t).css("position");)t=t.offsetParent;return t})},position:function(){var t,e,i,o;if(this.length)return t=this[0],i=this.offsetParent(),o=X.test(i[0].nodeName)?{top:0,left:0}:i.offset(),"fixed"===w(t).css("position")?e=t.getBoundingClientRect():(e=this.offset(),o.top+=parseFloat(w(i[0]).css("border-top-width"))||0,o.left+=parseFloat(w(i[0]).css("border-left-width"))||0),{top:e.top-o.top-parseFloat(w(t).css("margin-top"))||0,left:e.left-o.left-parseFloat(w(t).css("margin-left"))||0}},on:function(u,d,f,p,g){var m,v,i=this;return u&&!$(u)?(w.each(u,function(t,e){i.on(t,d,f,e,g)}),i):($(d)||c(p)||!1===p||(p=f,f=d,d=void 0),void 0!==p&&!1!==f||(p=f,f=void 0),!1===p&&(p=lt),i.each(function(t,i){var o,e,n,s,a,r,h,l,c;g&&(m=function(t){return bt(i,t.type,p),p.apply(this,arguments)}),e=u,n=p,s=f,r=(v=(a=d)?function(t){var e=w(t.target).closest(d,i).get(0);if(e&&e!==i)return t=w.extend(function(t){var e,i={originalEvent:t};for(e in t)gt.test(e)||void 0===t[e]||(i[e]=t[e]);return ut(i,t)}(t),{currentTarget:e,liveFired:i}),(m||p).apply(e,[t].concat(b.call(arguments,1)))}:v)||m,l=z(o=i),c=M[l]||(M[l]=[]),e.split(/\s/).forEach(function(t){if("ready"==t)return w(y).ready(n);var e=mt(t),i=(e.fn=n,e.sel=a,e.e in pt&&(n=function(t){t=t.relatedTarget;if(!t||t!==this&&!x(this,t))return e.fn.apply(this,arguments)}),(e.del=r)||n);e.proxy=function(t){var e;if(!(t=ut(t)).isImmediatePropagationStopped())return t.data=s,!1===(e=i.apply(o,null==t._args?[t]:[t].concat(t._args)))&&(t.preventDefault(),t.stopPropagation()),e},e.i=c.length,c.push(e),"addEventListener"in o&&o.addEventListener(yt(e.e),e.proxy,wt(e,h))})}))},off:function(t,i,e){var o=this;return t&&!$(t)?(w.each(t,function(t,e){o.off(t,i,e)}),o):($(i)||c(e)||!1===e||(e=i,i=void 0),!1===e&&(e=lt),o.each(function(){bt(this,t,e,i)}))},show:function(t,e){return Et.call(this),void 0===t?t=0:this.css("opacity",0),It(this,t,1,"1,1",e)},hide:function(t,e){return void 0===t?Pt.call(this):(i=e,It(this,t,0,"0,0",function(){Pt.call(w(this)),i&&i.call(this)}));var i},anim:function(t,e,i,o,n){var s,a,r,h={},l="",c=this,u=w.fx.transitionEnd,d=!1;if(void 0===e&&(e=w.fx.speeds._default/1e3),void 0===n&&(n=0),w.fx.off&&(e=0),"string"==typeof t)h[Lt]=t,h[Dt]=e+"s",h[kt]=n+"s",h[Ht]=i||"linear",u=w.fx.animationEnd;else{for(s in a=[],t)Vt.test(s)?l+=s+"("+t[s]+") ":(h[s]=t[s],a.push(s.replace(/([A-Z])/g,"-$1").toLowerCase()));l&&(h[zt]=l,a.push(zt)),0<e&&"object"==typeof t&&(h[$t]=a.join(", "),h[Mt]=e+"s",h[Ct]=n+"s",h[Tt]=i||"linear")}return r=function(t){if(void 0!==t){if(t.target!==t.currentTarget)return;w(t.target).off(u,r)}else w(this).off(u,r);d=!0,w(this).css(m),o&&o.call(this)},0<e&&(this.on(u,r),setTimeout(function(){d||r.call(c)},1e3*(e+n)+25)),this.size()&&this.get(0).clientLeft,this.css(h),e<=0&&setTimeout(function(){c.each(function(){r.call(this)})},0),this},animate:function(t,e,i,o,n){return c(e)&&(o=e,e=i=void 0),c(i)&&(o=i,i=void 0),u(e)&&(i=e.easing,o=e.complete,n=e.delay,e=e.duration),e=e&&("number"==typeof e?e:w.fx.speeds[e]||w.fx.speeds._default)/1e3,n=n&&parseFloat(n)/1e3,this.anim(t,e,i,o,n)},fadeTo:function(t,e,i){return It(this,t,e,null,i)},fadeIn:function(t,e){var i=this.css("opacity");return 0<i?this.css("opacity",0):i=1,Et.call(this).fadeTo(t,i,e)}},_t=(H.extend({isPlainObject:u,isArray:l,noop:function(){}}),H.fn.extend(e),{draggable:!0,resizable:!0,movable:!0,keyboard:!0,title:!0,modalWidth:320,modalHeight:320,fixedModalSize:!1,initMaximized:!1,gapThreshold:.02,ratioThreshold:.1,minRatio:.05,maxRatio:16,headerToolbar:["maximize","close"],footerToolbar:["zoomIn","zoomOut","prev","fullscreen","next","actualSize","rotateRight"],icons:{minimize:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M20,14H4V10H20"></path>\n </svg>',maximize:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M4,4H20V20H4V4M6,8V18H18V8H6Z"></path>\n </svg>',close:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M13.46,12L19,17.54V19H17.54L12,13.46L6.46,19H5V17.54L10.54,12\n L5,6.46V5H6.46L12,10.54L17.54,5H19V6.46L13.46,12Z"></path>\n </svg>',zoomIn:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M15.5,14L20.5,19L19,20.5L14,15.5V14.71L13.73,14.43\n C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3A6.5,6.5 0 0,1 16,9.5\n C16,11.11 15.41,12.59 14.43,13.73L14.71,14H15.5M9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5\n C7,5 5,7 5,9.5C5,12 7,14 9.5,14M12,10H10V12H9V10H7V9H9V7H10V9H12V10Z"></path>\n </svg>',zoomOut:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M15.5,14H14.71L14.43,13.73C15.41,12.59 16,11.11 16,9.5\n A6.5,6.5 0 0,0 9.5,3A6.5,6.5 0 0,0 3,9.5A6.5,6.5 0 0,0 9.5,16\n C11.11,16 12.59,15.41 13.73,14.43L14,14.71V15.5L19,20.5L20.5,19L15.5,14M9.5,14\n C7,14 5,12 5,9.5C5,7 7,5 9.5,5C12,5 14,7 14,9.5C14,12 12,14 9.5,14M7,9H12V10H7V9Z"></path>\n </svg>',prev:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z"></path>\n </svg>',next:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M16,18H18V6H16M6,18L14.5,12L6,6V18Z"></path>\n </svg>',fullscreen:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M8.5,12.5L11,15.5L14.5,11L19,17H5M23,18V6A2,2 0 0,0 21,4H3\n A2,2 0 0,0 1,6V18A2,2 0 0,0 3,20H21A2,2 0 0,0 23,18Z"></path>\n </svg>',actualSize:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09\n M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19\n H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91\n L13.09,9.5Z"></path>\n </svg>',rotateLeft:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12\n C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07\n M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32\n M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13\n M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z"></path>\n </svg>',rotateRight:'<svg viewBox="0 0 24 24" class="svg-inline-icon">\n <path fill="currentColor" d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91\n C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31\n L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11\n L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12\n C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10\n L15.55,5.55Z"></path>\n </svg>'},i18n:{minimize:"Minimize",maximize:"Maximize (Alt+X)",close:"Close (Q)",zoomIn:"Zoom-in (+)",zoomOut:"Zoom-out (-)",prev:"Prev (←)",next:"Next (→)",fullscreen:"Fullscreen (F)",actualSize:"Actual-size (Ctrl+Alt+0)",rotateLeft:"Rotate-left (Ctrl+,)",rotateRight:"Rotate-right (Ctrl+.)"},multiInstances:!0,initAnimation:!0,animationDuration:400,fixedModalPos:!1,zIndex:1090,dragHandle:null,callbacks:{beforeOpen:H.noop,opened:H.noop,beforeClose:H.noop,closed:H.noop,beforeChange:H.noop,changed:H.noop},index:0,progressiveLoading:!0,appendTo:"body",customButtons:{},positionFixed:!0,initModalPos:null}),Rt=window.document;function St(t,e,i,o){var n=o?t.h:t.w,o=o?t.w:t.h;(o>e.h||n>e.w)&&i.addClass("is-grab"),o<=e.h&&n<=e.w&&i.removeClass("is-grab")}function At(){return"ontouchstart"in window||window.DocumentTouch&&Rt instanceof window.DocumentTouch}function v(t){return/^(?:body|html)$/i.test(t.nodeName)}function T(i,t){return t.reduce(function(t,e){return t+parseFloat(i.css(e))},0)}function k(t){return"border-box"===t.css("box-sizing")}var Ot=H(window),V=H(Rt),C="click",Ft="keydown",jt="wheel mousewheel DOMMouseScroll",Bt=At()?"touchstart":"mousedown",E=At()?"touchmove":"mousemove",P=At()?"touchend":"mouseup",I="photoviewer",L="."+I,_="."+I,R={isMoving:!1,isResizing:!1,zIndex:0},t={draggable:function(i,t,e){var o=this,n=!1,s=0,a=0,r=0,h=0,l=function(t){var e;(t=t||window.event).preventDefault(),!n||R.isMoving||R.isResizing||o.isMaximized||(e="touchmove"===t.type?t.targetTouches[0].pageX:t.clientX,t="touchmove"===t.type?t.targetTouches[0].pageY:t.clientY,e=e-s,t=t-a,i.css({left:e+r,top:t+h}))},c=function t(){V.off(E+_,l).off(P+_,t),n=!1,i[0].focus()};H(t).on(Bt+_,function(t){if(t=t||window.event,i[0].blur(),H(t.target).closest(e).length)return!0;o.options.multiInstances&&i.css("z-index",++R.zIndex),n=!0,s="touchstart"===t.type?t.targetTouches[0].pageX:t.clientX,a="touchstart"===t.type?t.targetTouches[0].pageY:t.clientY,r=parseFloat(i.css("left")),h=parseFloat(i.css("top")),i.css({left:r,top:h,right:"",bottom:""}),V.on(E+_,l).on(P+_,c)})}},Nt="html, body, .".concat(I,"-modal, .").concat(I,"-stage, .").concat(I,"-button, .").concat(I,"-resizable-handle"),e={movable:function(s,a){function r(){V.off(E+_,v).off(P+_,r),l=!1,R.isMoving=!1,H(Nt).removeClass("is-grabbing")}var h=this,l=!1,c=0,u=0,d=0,f=0,p=0,g=0,m=0,v=function(t){var e,i,o;(t=t||window.event).preventDefault(),l&&(e="touchmove"===t.type?t.targetTouches[0].pageX:t.clientX,t="touchmove"===t.type?t.targetTouches[0].pageY:t.clientY,i=(e=e-c)+d,o=(t=t-u)+f,0<g?m<t+f?o=m:t+f<-g+m&&(o=-g+m):o=f,0<p?-m<e+d?i=-m:e+d<-p-m&&(i=-p-m):i=d,a.css({left:i,top:o}),H.extend(h.imageData,{left:i,top:o}))};s.on(Bt+_,function(t){(t=t||window.event).preventDefault();var e=a.width(),i=a.height(),o=s.width(),n=s.height();c="touchstart"===t.type?t.targetTouches[0].pageX:t.clientX,u="touchstart"===t.type?t.targetTouches[0].pageY:t.clientY,m=h.isRotated?(e-i)/2:0,p=h.isRotated?i-o:e-o,g=h.isRotated?e-n:i-n,l=0<p||0<g,R.isMoving=0<p||0<g,d=a.position().left-m,f=a.position().top+m,s.hasClass("is-grab")&&H(Nt).addClass("is-grabbing"),V.on(E+_,v).on(P+_,r)})}},Yt="html, body, .".concat(I,"-modal, .").concat(I,"-stage, .").concat(I,"-button"),Xt={resizable:function(o,n,l,c,u){var s=this,t=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-e"></div>')),e=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-w"></div>')),i=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-s"></div>')),a=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-n"></div>')),r=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-se"></div>')),h=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-sw"></div>')),d=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-ne"></div>')),f=H('<div class="'.concat(I,"-resizable-handle ").concat(I,'-resizable-handle-nw"></div>')),p={e:t,s:i,se:r,n:a,w:e,nw:f,ne:d,sw:h},g=(o.append(t,e,i,a,r,h,d,f),!1),m=0,v=0,w={w:0,h:0,x:0,y:0},y={w:0,h:0,x:0,y:0},b={w:0,h:0,x:0,y:0},x=0,z=0,$=0,M="",T=function(t,e,i){var o=-e+w.w>c?e+w.x:w.x+w.w-c,n=-i+w.h>u?i+w.y:w.y+w.h-u;return{e:{width:Math.max(e+w.w,c)},s:{height:Math.max(i+w.h,u)},se:{width:Math.max(e+w.w,c),height:Math.max(i+w.h,u)},w:{width:Math.max(-e+w.w,c),left:o},n:{height:Math.max(-i+w.h,u),top:n},nw:{width:Math.max(-e+w.w,c),height:Math.max(-i+w.h,u),top:n,left:o},ne:{width:Math.max(e+w.w,c),height:Math.max(-i+w.h,u),top:n},sw:{width:Math.max(-e+w.w,c),height:Math.max(i+w.h,u),left:o}}[t]},C=function(t,e,i){var o=e+w.w>c?y.w-z+e-x:c-(w.w-y.w)-z-x,n=i+w.h>u?y.h-$+i+x:u-(w.h-y.h)-$+x,e=-e+w.w>c?y.w-z-e-x:c-(w.w-y.w)-z-x,i=-i+w.h>u?y.h-$-i+x:u-(w.h-y.h)-$+x,s=(0<o||l.position().left<0?l.position().left:0)-x,a=(0<n||l.position().top<0?l.position().top:0)+x,r=(0<e||l.position().left<0?l.position().left:0)-x,h=(0<i||l.position().top<0?l.position().top:0)+x;return{e:{left:-x<=o?(o-x)/2:o<s?s:o},s:{top:x<=n?(n+x)/2:n<a?a:n},se:{top:x<=n?(n+x)/2:n<a?a:n,left:-x<=o?(o-x)/2:o<s?s:o},w:{left:-x<=e?(e-x)/2:e<r?r:e},n:{top:x<=i?(i+x)/2:i<h?h:i},nw:{top:x<=i?(i+x)/2:i<h?h:i,left:-x<=e?(e-x)/2:e<r?r:e},ne:{top:x<=i?(i+x)/2:i<h?h:i,left:-x<=o?(o-x)/2:o<s?s:o},sw:{top:x<=n?(n+x)/2:n<a?a:n,left:-x<=e?(e-x)/2:e<r?r:e}}[t]},L=function(t){var e,i;(t=t||window.event).preventDefault(),g&&!s.isMaximized&&(e="touchmove"===t.type?t.targetTouches[0].pageX:t.clientX,t="touchmove"===t.type?t.targetTouches[0].pageY:t.clientY,i=T(M,e=e-m,t=t-v),o.css(i),i=C(M,e,t),l.css(i),s.isDoResize=!0)},D=function t(){V.off(E+_,L).off(P+_,t),R.isResizing&&St({w:z,h:$},{w:n.width(),h:n.height()},n),g=!1,R.isResizing=!1,H(Yt).css("cursor","");var e=s.getImageScale(n.width(),n.height());H.extend(s.imageData,{initWidth:s.img.width*e,initHeight:s.img.height*e,initLeft:(n.width()-s.img.width*e)/2,initTop:(n.height()-s.img.height*e)/2})};H.each(p,function(i,t){t.on(Bt+_,function(t){var e;e=i,(t=(t=t)||window.event).preventDefault(),g=!0,R.isResizing=!0,m="touchstart"===t.type?t.targetTouches[0].pageX:t.clientX,v="touchstart"===t.type?t.targetTouches[0].pageY:t.clientY,w={w:o.width()+(k(o)?s._modalEdgeValue.horizontal:0),h:o.height()+(k(o)?s._modalEdgeValue.vertical:0),x:o.position().left,y:o.position().top},y={w:n.width(),h:n.height(),x:n.position().left,y:n.position().top},b={w:l.width(),h:l.height(),x:l.position().left,y:l.position().top},x=s.isRotated?(b.w-b.h)/2:0,z=s.isRotated?b.h:b.w,$=s.isRotated?b.w:b.h,M=e,H(Yt).css("cursor",e+"-resize"),V.on(E+_,L).on(P+_,D)})})}},Wt=function(){function o(t,e,i){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function");this.options=H.extend(!0,{},_t,e),e&&H.isArray(e.footerToolbar)&&(this.options.footerToolbar=e.footerToolbar),e&&H.isArray(e.headerToolbar)&&(this.options.headerToolbar=e.headerToolbar),this.$el=H(i),this.isOpened=!1,this.isMaximized=!1,this.isRotated=!1,this.rotationDegree=0,this.isDoResize=!1,this.imageData={},this.modalData={width:null,height:null,left:null,top:null},this._lastTimestamp=0,this.init(t,this.options)}var t,e,i;return t=o,(e=[{key:"init",value:function(t,e){this.groupData=t,this.groupIndex=e.index,R.zIndex=(0===R.zIndex?e:R).zIndex;t=t[this.groupIndex].src;this.open(),this.loadImage(t),e.draggable&&this.draggable(this.$photoviewer,this.dragHandle,L+"-button"),e.movable&&this.movable(this.$stage,this.$image),e.resizable&&this.resizable(this.$photoviewer,this.$stage,this.$image,e.modalWidth,e.modalHeight)}},{key:"_createBtns",value:function(t){var o=this,n=["minimize","maximize","close","zoomIn","zoomOut","prev","next","fullscreen","actualSize","rotateLeft","rotateRight"],s="";return H.each(t,function(t,e){var i="".concat(I,"-button ").concat(I,"-button-").concat(e);0<=n.indexOf(e)?s+='<button class="'.concat(i,'" title="').concat(o.options.i18n[e],'">\n ').concat(o.options.icons[e],"\n </button>"):o.options.customButtons[e]&&(s+='<button class="'.concat(i,'" title="').concat(o.options.customButtons[e].title||"",'">\n ').concat(o.options.customButtons[e].text,"\n </button>"))}),s}},{key:"_createTitle",value:function(){return this.options.title?'<div class="'.concat(I,'-title"></div>'):""}},{key:"_createTemplate",value:function(){return'<div class="'.concat(I,'-modal" tabindex="0">\n <div class="').concat(I,'-inner">\n <div class="').concat(I,'-header">\n <div class="').concat(I,"-toolbar ").concat(I,'-toolbar-header">\n ').concat(this._createBtns(this.options.headerToolbar),"\n </div>\n ").concat(this._createTitle(),'\n </div>\n <div class="').concat(I,'-stage">\n <img class="').concat(I,'-image" src="" alt="" />\n </div>\n <div class="').concat(I,'-footer">\n <div class="').concat(I,"-toolbar ").concat(I,'-toolbar-footer">\n ').concat(this._createBtns(this.options.footerToolbar),"\n </div>\n </div>\n </div>\n </div>")}},{key:"build",value:function(){var t=this._createTemplate(),t=H(t);this.$photoviewer=t,this.$stage=t.find(L+"-stage"),this.$title=t.find(L+"-title"),this.$image=t.find(L+"-image"),this.$close=t.find(L+"-button-close"),this.$maximize=t.find(L+"-button-maximize"),this.$minimize=t.find(L+"-button-minimize"),this.$zoomIn=t.find(L+"-button-zoomIn"),this.$zoomOut=t.find(L+"-button-zoomOut"),this.$actualSize=t.find(L+"-button-actualSize"),this.$fullscreen=t.find(L+"-button-fullscreen"),this.$rotateLeft=t.find(L+"-button-rotateLeft"),this.$rotateRight=t.find(L+"-button-rotateRight"),this.$prev=t.find(L+"-button-prev"),this.$next=t.find(L+"-button-next"),this.$stage.addClass("stage-ready"),this.$image.addClass("image-ready"),this.$photoviewer.css("z-index",R.zIndex),this.options.positionFixed&&this.$photoviewer.css({position:"fixed"}),this.options.dragHandle&&this.options.dragHandle!==L+"-modal"?this.dragHandle=this.$photoviewer.find(this.options.dragHandle):this.dragHandle=this.$photoviewer,H(this.options.appendTo).eq(0).append(this.$photoviewer),this._stageEdgeValue={horizontal:T(this.$stage,["left","right","border-left-width","border-right-width"]),vertical:T(this.$stage,["top","bottom","border-top-width","border-bottom-width"])},this._modalEdgeValue={horizontal:T(this.$photoviewer,["padding-left","padding-right","border-left-width","border-right-width"]),vertical:T(this.$photoviewer,["padding-top","padding-bottom","border-top-width","border-bottom-width"])},this._addEvents(),this._addCustomButtonEvents()}},{key:"open",value:function(){this._triggerHook("beforeOpen",this),this.options.multiInstances||H(L+"-modal").eq(0).remove(),this.build(),this.setInitModalPos(),this._triggerHook("opened",this)}},{key:"close",value:function(){this._triggerHook("beforeClose",this),this.$photoviewer.remove(),this.isOpened=!1,this.isMaximized=!1,this.isRotated=!1,this.rotationDegree=0,H(L+"-modal").length||(this.options.multiInstances&&(R.zIndex=this.options.zIndex),Ot.off("resize"+_)),this._triggerHook("closed",this)}},{key:"_getOffsetParentData",value:function(){var t=H(this.options.appendTo)[0];return{width:this.options.positionFixed||v(t)?Ot.width():t.clientWidth,height:this.options.positionFixed||v(t)?Ot.height():t.clientHeight,scrollLeft:this.options.positionFixed?0:v(t)?V.scrollLeft():t.scrollLeft,scrollTop:this.options.positionFixed?0:v(t)?V.scrollTop():t.scrollTop}}},{key:"setModalToCenter",value:function(){var t,e,i,o,n,s=0,a=0,s=(k(this.$photoviewer)||(s+=this._modalEdgeValue.horizontal,a+=this._modalEdgeValue.vertical),H.isPlainObject(this.options.initModalPos)?(o=this.options.initModalPos.left,n=this.options.initModalPos.top,t=this.options.initModalPos.right,e=this.options.initModalPos.bottom):(o=((i=this._getOffsetParentData()).width-this.options.modalWidth-s)/2+i.scrollLeft,n=(i.height-this.options.modalHeight-a)/2+i.scrollTop),{width:this.modalData.width||this.options.modalWidth,height:this.modalData.height||this.options.modalHeight,left:this.modalData.left||o,top:this.modalData.top||n,right:this.modalData.right||t,bottom:this.modalData.bottom||e});this.$photoviewer.css(s)}},{key:"setInitModalPos",value:function(){this.options.initMaximized?(this.maximize(),this.isOpened=!0):this.setModalToCenter(),this.$photoviewer[0].focus()}},{key:"setModalSize",value:function(t){var e,i,o,n,s=this,a=this._getOffsetParentData(),r=t.width+this._stageEdgeValue.horizontal,h=t.height+this._stageEdgeValue.vertical,l=0,c=0,u=(k(this.$photoviewer)?(r+=this._modalEdgeValue.horizontal,h+=this._modalEdgeValue.vertical):(l+=this._modalEdgeValue.horizontal,c+=this._modalEdgeValue.vertical),(0<this.options.gapThreshold?this.options.gapThreshold:0)+1),a=Math.min(a.width/((r+l)*u),a.height/((h+c)*u),1),u=Math.max(r*a,this.options.modalWidth),r=Math.max(h*a,this.options.modalHeight),u=this.options.fixedModalSize?this.options.modalWidth:Math.round(u),r=this.options.fixedModalSize?this.options.modalHeight:Math.round(r),a=(H.isPlainObject(this.options.initModalPos)?(o=this.options.initModalPos.left,n=this.options.initModalPos.top,e=this.options.initModalPos.right,i=this.options.initModalPos.bottom):(o=((h=this._getOffsetParentData()).width-u-l)/2+h.scrollLeft,n=(h.height-r-c)/2+h.scrollTop),{width:u,height:r,left:o,top:n,right:e,bottom:i});this.options.initAnimation?this.$photoviewer.animate(a,this.options.animationDuration,"ease-in-out",function(){s.setImageSize(t)}):(this.$photoviewer.css(a),this.setImageSize(t)),this.isOpened=!0}},{key:"getImageScale",value:function(t,e){return this.isRotated?Math.min(t/this.img.height,e/this.img.width,1):Math.min(t/this.img.width,e/this.img.height,1)}},{key:"setImageSize",value:function(t){var e={w:this.$stage.width(),h:this.$stage.height()},i=this.getImageScale(e.w,e.h);this.$image.css({width:Math.round(t.width*i),height:Math.round(t.height*i),left:(e.w-Math.round(t.width*i))/2,top:(e.h-Math.round(t.height*i))/2}),H.extend(this.imageData,{initWidth:t.width*i,initHeight:t.height*i,initLeft:(e.w-t.width*i)/2,initTop:(e.h-t.height*i)/2,width:t.width*i,height:t.height*i,left:(e.w-t.width*i)/2,top:(e.h-t.height*i)/2}),St({w:this.$image.width(),h:this.$image.height()},{w:this.$stage.width(),h:this.$stage.height()},this.$stage,this.isRotated),this.imageLoaded||(this.$photoviewer.find(L+"-loader").remove(),this.$stage.removeClass("stage-ready"),this.$image.removeClass("image-ready"),this.options.initAnimation&&!this.options.progressiveLoading&&this.$image.fadeIn(),this.imageLoaded=!0)}},{key:"loadImage",value:function(t,e,i){var o,n,s,a,r=this;this.$image.removeAttr("style").attr("src",""),this.isRotated=!1,this.rotationDegree=0,this.imageLoaded=!1,this.$photoviewer.append('<div class="'.concat(I,'-loader"></div>')),this.$stage.addClass("stage-ready"),this.$image.addClass("image-ready"),this.options.initAnimation&&!this.options.progressiveLoading&&this.$image.hide(),this.$image.attr("src",t),o=t,n=function(t){r.img=t,r.imageData={originalWidth:t.width,originalHeight:t.height},r.isMaximized||r.isOpened&&r.options.fixedModalPos?r.setImageSize(t):r.setModalSize(t),e&&e.call()},s=function(){r.$photoviewer.find(L+"-loader").remove(),i&&i.call()},(a=new Image).onload=function(){n(a)},a.onerror=function(){s(a)},a.src=o,this.options.title&&this.setImageTitle(t)}},{key:"setImageTitle",value:function(t){t=this.groupData[this.groupIndex].title||t.replace(/^.*?\/*([^/?]*)\.[a-z]+(\?.+|$)/gi,"$1");this.$title.html(t)}},{key:"jump",value:function(t){this._triggerHook("beforeChange",[this,this.groupIndex]);var e=Date.now();e-this._lastTimestamp>=this.options.animationDuration&&(this.groupIndex=this.groupIndex+t,this.jumpTo(this.groupIndex),this._lastTimestamp=e)}},{key:"jumpTo",value:function(t){var e=this;0<=(t%=this.groupData.length)?t%=this.groupData.length:t<0&&(t=(this.groupData.length+t)%this.groupData.length),this.groupIndex=t,this.loadImage(this.groupData[t].src,function(){e._triggerHook("changed",[e,t])},function(){e._triggerHook("changed",[e,t])})}},{key:"wheel",value:function(t){t.preventDefault();var e=1,e=(t.deltaY?e=0<t.deltaY?1:-1:t.wheelDelta?e=-t.wheelDelta/120:t.detail&&(e=0<t.detail?1:-1),-e*this.options.ratioThreshold),t={x:t.clientX-this.$stage.offset().left+V.scrollLeft(),y:t.clientY-this.$stage.offset().top+V.scrollTop()};this.zoom(e,t)}},{key:"zoom",value:function(t,e){t=t<0?1/(1-t):1+t,(t=this.$image.width()/this.imageData.originalWidth*t)>this.options.maxRatio||t<this.options.minRatio||this.zoomTo(t,e)}},{key:"zoomTo",value:function(t,e){var i=this.$image,o=this.$stage,n=this.imageData.width,s=this.imageData.height,a=this.imageData.left,r=this.imageData.top,h={w:o.width(),h:o.height(),x:o.offset().left,y:o.offset().top},o=(void 0===e&&(e={x:o.width()/2,y:o.height()/2}),this.imageData.originalWidth*t),t=this.imageData.originalHeight*t,a=e.x-(e.x-a)/n*o,n=e.y-(e.y-r)/s*t,e=this.isRotated?(o-t)/2:0,r=this.isRotated?t:o,s=this.isRotated?o:t,l=h.w-o,c=h.h-t,n=s<=h.h?(h.h-t)/2:e<n?e:c-e<n?n:c-e,a=r<=h.w?(h.w-o)/2:-e<a?-e:l+e<a?a:l+e;Math.abs(this.imageData.initWidth-o)<.05*this.imageData.initWidth?this.setImageSize(this.img):(i.css({width:Math.round(o),height:Math.round(t),left:Math.round(a),top:Math.round(n)}),St({w:Math.round(r),h:Math.round(s)},{w:h.w,h:h.h},this.$stage)),H.extend(this.imageData,{width:o,height:t,left:a,top:n})}},{key:"rotate",value:function(t){this.rotationDegree=this.rotationDegree+t,this.rotationDegree/90%2==0?this.isRotated=!1:this.isRotated=!0,this.rotateTo(this.rotationDegree)}},{key:"rotateTo",value:function(t){this.$image.css({transform:"rotate("+t+"deg)"}),this.setImageSize({width:this.imageData.originalWidth,height:this.imageData.originalHeight}),this.$stage.removeClass("is-grab")}},{key:"resize",value:function(){this.isOpened&&(this.isMaximized?this.setImageSize({width:this.imageData.originalWidth,height:this.imageData.originalHeight}):this.setModalSize({width:this.imageData.originalWidth,height:this.imageData.originalHeight}))}},{key:"maximize",value:function(){this.$photoviewer.addClass(I+"-maximized"),this.$photoviewer.css({width:"auto",height:"auto",top:0,right:0,bottom:0,left:0}),this.isMaximized=!0}},{key:"exitMaximize",value:function(){this.$photoviewer.removeClass(I+"-maximized"),this.setModalToCenter(),this.isMaximized=!1}},{key:"toggleMaximize",value:function(){var t,e;this.isMaximized?this.exitMaximize():(t=this.$photoviewer.width(),e=this.$photoviewer.height(),k(this.$photoviewer)&&(t+=this._modalEdgeValue.horizontal,e+=this._modalEdgeValue.vertical),this.modalData={width:t,height:e,left:parseFloat(this.$photoviewer.css("left")),top:parseFloat(this.$photoviewer.css("top"))},this.maximize()),this.setImageSize({width:this.imageData.originalWidth,height:this.imageData.originalHeight}),this.$photoviewer[0].focus()}},{key:"fullscreen",value:function(){var t;(t=this.$photoviewer[0]).requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen(),this.$photoviewer[0].focus()}},{key:"_keydown",value:function(t){if(!this.options.keyboard)return!1;t.preventDefault();var e=t.keyCode||t.which||t.charCode,i=t.ctrlKey||t.metaKey,o=t.altKey;switch(e){case 37:this.jump(-1);break;case 39:this.jump(1);break;case 187:this.zoom(3*this.options.ratioThreshold,{x:this.$stage.width()/2,y:this.$stage.height()/2},t);break;case 189:this.zoom(3*-this.options.ratioThreshold,{x:this.$stage.width()/2,y:this.$stage.height()/2},t);break;case 61:this.zoom(3*this.options.ratioThreshold,{x:this.$stage.width()/2,y:this.$stage.height()/2},t);break;case 173:this.zoom(3*-this.options.ratioThreshold,{x:this.$stage.width()/2,y:this.$stage.height()/2},t);break;case 48:i&&o&&this.zoomTo(1,{x:this.$stage.width()/2,y:this.$stage.height()/2},t);break;case 188:i&&this.rotate(-90);break;case 190:i&&this.rotate(90);break;case 81:this.close();break;case 88:o&&this.toggleMaximize();break;case 70:this.fullscreen()}}},{key:"_addEvents",value:function(){var i,o,n,e=this;this.$close.off(C+_).on(C+_,function(){e.close()}),this.$stage.off(jt+_).on(jt+_,function(t){e.wheel(t)}),this.$zoomIn.off(C+_).on(C+_,function(){e.zoom(3*e.options.ratioThreshold)}),this.$zoomOut.off(C+_).on(C+_,function(){e.zoom(3*-e.options.ratioThreshold)}),this.$actualSize.off(C+_).on(C+_,function(){e.zoomTo(1)}),this.$prev.off(C+_).on(C+_,function(){e.jump(-1)}),this.$fullscreen.off(C+_).on(C+_,function(){e.fullscreen()}),this.$next.off(C+_).on(C+_,function(){e.jump(1)}),this.$rotateLeft.off(C+_).on(C+_,function(){e.rotate(-90)}),this.$rotateRight.off(C+_).on(C+_,function(){e.rotate(90)}),this.$maximize.off(C+_).on(C+_,function(){e.toggleMaximize()}),this.$photoviewer.off(Ft+_).on(Ft+_,function(t){e._keydown(t)}),Ot.on("resize"+_,(i=function(){return e.resize()},o=500,n=null,function(){var t=this,e=arguments;clearTimeout(n),n=setTimeout(function(){i.apply(t,e)},o)}))}},{key:"_addCustomButtonEvents",value:function(){var t,i=this;for(t in this.options.customButtons)!function(e){i.$photoviewer.find(L+"-button-"+e).off(C+_).on(C+_,function(t){i.options.customButtons[e].click.apply(i,[i,t])})}(t)}},{key:"_triggerHook",value:function(t,e){this.options.callbacks[t]&&this.options.callbacks[t].apply(this,H.isArray(e)?e:[e])}}])&&D(t.prototype,e),i&&D(t,i),Object.defineProperty(t,"prototype",{writable:!1}),o}();return H.extend(Wt.prototype,t,e,Xt),window.PhotoViewer=Wt});