Comparing version 0.0.1 to 0.0.2
@@ -1,11 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["rc-viewer"]=t(require("react")):e["rc-viewer"]=t(e.react)}(window,function(e){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=7)}([function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var i=t.protocol+"//"+t.host,n=i+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}},function(e,t,i){var n,o,r={},s=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var i=function(e){return document.querySelector(e)}.call(this,e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}}(),h=null,l=0,c=[],u=i(0);function d(e,t){for(var i=0;i<e.length;i++){var n=e[i],o=r[n.id];if(o){o.refs++;for(var s=0;s<o.parts.length;s++)o.parts[s](n.parts[s]);for(;s<n.parts.length;s++)o.parts.push(g(n.parts[s],t))}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(g(n.parts[s],t));r[n.id]={id:n.id,refs:1,parts:a}}}}function f(e,t){for(var i=[],n={},o=0;o<e.length;o++){var r=e[o],s=t.base?r[0]+t.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[s]?n[s].parts.push(a):i.push(n[s]={id:s,parts:[a]})}return i}function v(e,t){var i=a(e.insertInto);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=c[c.length-1];if("top"===e.insertAt)n?n.nextSibling?i.insertBefore(t,n.nextSibling):i.appendChild(t):i.insertBefore(t,i.firstChild),c.push(t);else if("bottom"===e.insertAt)i.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=a(e.insertInto+" "+e.insertAt.before);i.insertBefore(t,o)}}function p(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=c.indexOf(e);t>=0&&c.splice(t,1)}function m(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),w(t,e.attrs),v(e,t),t}function w(e,t){Object.keys(t).forEach(function(i){e.setAttribute(i,t[i])})}function g(e,t){var i,n,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var s=l++;i=h||(h=m(t)),n=x.bind(null,i,s,!1),o=x.bind(null,i,s,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",w(t,e.attrs),v(e,t),t}(t),n=function(e,t,i){var n=i.css,o=i.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(n=u(n));o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,i,t),o=function(){p(i),i.href&&URL.revokeObjectURL(i.href)}):(i=m(t),n=function(e,t){var i=t.css,n=t.media;n&&e.setAttribute("media",n);if(e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}.bind(null,i),o=function(){p(i)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=s()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var i=f(e,t);return d(i,t),function(e){for(var n=[],o=0;o<i.length;o++){var s=i[o];(a=r[s.id]).refs--,n.push(a)}e&&d(f(e,t),t);for(o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var h=0;h<a.parts.length;h++)a.parts[h]();delete r[a.id]}}}};var b,y=(b=[],function(e,t){return b[e]=t,b.filter(Boolean).join("\n")});function x(e,t,i,n){var o=i?"":n.css;if(e.styleSheet)e.styleSheet.cssText=y(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i=function(e,t){var i=e[1]||"",n=e[3];if(!n)return i;if(t&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=n.sources.map(function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"});return[i].concat(r).concat([o]).join("\n")}var s;return[i].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i}).join("")},t.i=function(e,i){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var s=e[o];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),t.push(s))}},t}},function(e,t,i){(e.exports=i(2)(!1)).push([e.i,'/*!\n * Viewer.js v1.0.0\n * https://github.com/fengyuanchen/viewerjs\n *\n * Copyright (c) 2015-2018 Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2018-04-01T05:32:30.097Z\n */.viewer-close:before,.viewer-flip-horizontal:before,.viewer-flip-vertical:before,.viewer-fullscreen-exit:before,.viewer-fullscreen:before,.viewer-next:before,.viewer-one-to-one:before,.viewer-play:before,.viewer-prev:before,.viewer-reset:before,.viewer-rotate-left:before,.viewer-rotate-right:before,.viewer-zoom-in:before,.viewer-zoom-out:before{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ+BEpNYDwKbpnQMeAw4m8HjQtM6Z9qa917zPQwFr3M5KgA6J5rTJCdFZJj9/lyvGhsDvwFNVuV2MhhjrK6b9bFiE+j1r87eBl4HDwCF7/U/k+ofAX5b/EXBv5JoLMuILzf3Ap6Z3EzgdqHMCuF7hcQf4HDgeoHnccncqdK/TvSDWffFXI/exICY/xZyqc6XLWF1UFZna4gJ7q8BsRvgd2/xXpo6P+D9dfT7PpECtA3cnWPM0GXGFZh/wgWltA+cDNC7X+AP4GzjZQe+k5dRxuYPeiuXU7e1qwLpDz7dFjXKRaSwuMLvAlG8zZlG+YmiK1HoFqT7wP2z+4Q45TfEGcMt01xLoNZEBTwRqD4BLpnMLeC1A41UmVxsXgXeBayV/Wx20rpTyrpnWRft7p6O/FdqzGrDukPNtkaMoMo3FBdBSQMOnYBCReyf05s126fU9ytfX98+mY54Kxnp7S9K3kj6U9KYdG0h6UdLbkh7poFXMfUnSOyVvL0h6VtIXHbS6nOP+s/Zm9mvyXW1uuC9ohZ72E9uDmXWLJOB1GxsH+DxPftsB8B6wlGDN02TAkxG6+4D3TWsbeC5CS8CDFce+AW500LhhOW2020TRjK3b21HEmgti9m0RonxbdMZeVzV+/4tF3cBpP7E9mKHNL5q8h5g0eYsCMQz0epq8gQrwMXAgcs0FGXGFRcB9wCemF9PkbYqM/Bas7fxLwNeJPdTdpo4itQti8lPMqTpXuozVRVXPpbHI3KkNTB1NfkL81j2mvhDp91HgV9MKuRIqrykj3WPq4rHyL+axj8/qGPmTqi6F9YDlHOvJU6oYcTsh/TYSzWmTE6JT19CtLTJt32D6CmHe0eQn1O8z5AXgT4sx4Vcu0/EQecMydB8z0hUWkTd2t4CrwNEePqMBcAR4mrBbwyXLPWJa8zrXmmLEhNBmfpkuY2102xxrih+pb+ieAb6vGhuA97UcJ5KR8gZ77K+99xxeYBzH6Q3/Z0fHcXrDC4zjOL3hBcZxnN74F+zlvXFWXF9PAAAAAElFTkSuQmCC");background-repeat:no-repeat;color:transparent;display:block;font-size:0;height:20px;line-height:0;width:20px}.viewer-zoom-in:before{background-position:0 0;content:"Zoom In"}.viewer-zoom-out:before{background-position:-20px 0;content:"Zoom Out"}.viewer-one-to-one:before{background-position:-40px 0;content:"One to One"}.viewer-reset:before{background-position:-60px 0;content:"Reset"}.viewer-prev:before{background-position:-80px 0;content:"Previous"}.viewer-play:before{background-position:-100px 0;content:"Play"}.viewer-next:before{background-position:-120px 0;content:"Next"}.viewer-rotate-left:before{background-position:-140px 0;content:"Rotate Left"}.viewer-rotate-right:before{background-position:-160px 0;content:"Rotate Right"}.viewer-flip-horizontal:before{background-position:-180px 0;content:"Flip Horizontal"}.viewer-flip-vertical:before{background-position:-200px 0;content:"Flip Vertical"}.viewer-fullscreen:before{background-position:-220px 0;content:"Enter Full Screen"}.viewer-fullscreen-exit:before{background-position:-240px 0;content:"Exit Full Screen"}.viewer-close:before{background-position:-260px 0;content:"Close"}.viewer-container{bottom:0;direction:ltr;font-size:0;left:0;line-height:0;overflow:hidden;position:absolute;right:0;-webkit-tap-highlight-color:transparent;top:0;-webkit-touch-callout:none;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.viewer-container::-moz-selection,.viewer-container ::-moz-selection{background-color:transparent}.viewer-container::selection,.viewer-container ::selection{background-color:transparent}.viewer-container img{display:block;height:auto;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.viewer-canvas{bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.viewer-canvas>img{height:auto;margin:15px auto;max-width:90%!important;width:auto}.viewer-footer{bottom:0;left:0;overflow:hidden;position:absolute;right:0;text-align:center}.viewer-navbar{background-color:rgba(0,0,0,.5);overflow:hidden}.viewer-list{box-sizing:content-box;height:50px;margin:0;overflow:hidden;padding:1px 0}.viewer-list>li{color:transparent;cursor:pointer;float:left;font-size:0;height:50px;line-height:0;opacity:.5;overflow:hidden;transition:opacity .15s;width:30px}.viewer-list>li:hover{opacity:.75}.viewer-list>li+li{margin-left:1px}.viewer-list>.viewer-loading{position:relative}.viewer-list>.viewer-loading:after{border-width:2px;height:20px;margin-left:-10px;margin-top:-10px;width:20px}.viewer-list>.viewer-active,.viewer-list>.viewer-active:hover{opacity:1}.viewer-player{background-color:#000;bottom:0;cursor:none;display:none;right:0}.viewer-player,.viewer-player>img{left:0;position:absolute;top:0}.viewer-toolbar ul{display:inline-block;margin:0 auto 5px;overflow:hidden;padding:3px 0}.viewer-toolbar li{background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;float:left;height:24px;overflow:hidden;transition:background-color .15s;width:24px}.viewer-toolbar li:hover{background-color:rgba(0,0,0,.8)}.viewer-toolbar li:before{margin:2px}.viewer-toolbar li+li{margin-left:1px}.viewer-toolbar .viewer-small{height:18px;margin-bottom:3px;margin-top:3px;width:18px}.viewer-toolbar .viewer-small:before{margin:-1px}.viewer-toolbar .viewer-large{height:30px;margin-bottom:-3px;margin-top:-3px;width:30px}.viewer-toolbar .viewer-large:before{margin:5px}.viewer-tooltip{background-color:rgba(0,0,0,.8);border-radius:10px;color:#fff;display:none;font-size:12px;height:20px;left:50%;line-height:20px;margin-left:-25px;margin-top:-10px;position:absolute;text-align:center;top:50%;width:50px}.viewer-title{color:#ccc;display:inline-block;font-size:12px;line-height:1;margin:0 5% 5px;max-width:90%;opacity:.8;overflow:hidden;text-overflow:ellipsis;transition:opacity .15s;white-space:nowrap}.viewer-title:hover{opacity:1}.viewer-button{background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;height:80px;overflow:hidden;position:absolute;right:-40px;top:-40px;transition:background-color .15s;width:80px}.viewer-button:focus,.viewer-button:hover{background-color:rgba(0,0,0,.8)}.viewer-button:before{bottom:15px;left:15px;position:absolute}.viewer-fixed{position:fixed}.viewer-open{overflow:hidden}.viewer-show{display:block}.viewer-hide{display:none}.viewer-backdrop{background-color:rgba(0,0,0,.5)}.viewer-invisible{visibility:hidden}.viewer-move{cursor:move;cursor:-webkit-grab;cursor:grab}.viewer-fade{opacity:0}.viewer-in{opacity:1}.viewer-transition{transition:all .3s}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.viewer-loading:after{-webkit-animation:a 1s linear infinite;animation:a 1s linear infinite;border:4px solid hsla(0,0%,100%,.1);border-left-color:hsla(0,0%,100%,.5);border-radius:50%;content:"";display:inline-block;height:40px;left:50%;margin-left:-20px;margin-top:-20px;position:absolute;top:50%;width:40px;z-index:1}@media (max-width:767px){.viewer-hide-xs-down{display:none}}@media (max-width:991px){.viewer-hide-sm-down{display:none}}@media (max-width:1199px){.viewer-hide-md-down{display:none}}',""])},function(e,t,i){var n=i(3);"string"==typeof n&&(n=[[e.i,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};i(1)(n,o);n.locals&&(e.exports=n.locals)},function(e,t,i){"use strict";i.r(t); | ||
/*! | ||
* Viewer.js v1.0.0 | ||
* https://github.com/fengyuanchen/viewerjs | ||
* | ||
* Copyright (c) 2015-2018 Chen Fengyuan | ||
* Released under the MIT license | ||
* | ||
* Date: 2018-04-01T05:33:18.955Z | ||
*/ | ||
var n={inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,interval:5e3,keyboard:!0,backdrop:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,zIndex:2015,zIndexInline:0,url:"src",container:"body",filter:null,ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null},o="undefined"!=typeof window,r=o?window:{},s="viewer-hide-md-down",a="viewer-hide-sm-down",h="viewer-hide-xs-down",l="viewer-in",c="viewer-transition",u=r.PointerEvent?"pointerdown":"touchstart mousedown",d=r.PointerEvent?"pointermove":"touchmove mousemove",f=r.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",v=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},w=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function g(e){return"string"==typeof e}var b=Number.isNaN||r.isNaN;function y(e){return"number"==typeof e&&!b(e)}function x(e){return void 0===e}function k(e){return"object"===(void 0===e?"undefined":p(e))&&null!==e}var z=Object.prototype.hasOwnProperty;function A(e){if(!k(e))return!1;try{var t=e.constructor,i=t.prototype;return t&&i&&z.call(i,"isPrototypeOf")}catch(e){return!1}}function D(e){return"function"==typeof e}function T(e,t){if(e&&D(t))if(Array.isArray(e)||y(e.length)){var i=e.length,n=void 0;for(n=0;n<i&&!1!==t.call(e,e[n],n,e);n+=1);}else k(e)&&Object.keys(e).forEach(function(i){t.call(e,e[i],i,e)});return e}var E=Object.assign||function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return k(e)&&i.length>0&&i.forEach(function(t){k(t)&&Object.keys(t).forEach(function(i){e[i]=t[i]})}),e},S=/^(?:width|height|left|top|marginLeft|marginTop)$/;function L(e,t){var i=e.style;T(t,function(e,t){S.test(t)&&y(e)&&(e+="px"),i[t]=e})}function C(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function I(e,t){if(t)if(y(e.length))T(e,function(e){I(e,t)});else if(e.classList)e.classList.add(t);else{var i=e.className.trim();i?i.indexOf(t)<0&&(e.className=i+" "+t):e.className=t}}function M(e,t){t&&(y(e.length)?T(e,function(e){M(e,t)}):e.classList?e.classList.remove(t):e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,"")))}function O(e,t,i){t&&(y(e.length)?T(e,function(e){O(e,t,i)}):i?I(e,t):M(e,t))}var R=/([a-z\d])([A-Z])/g;function N(e){return e.replace(R,"$1-$2").toLowerCase()}function j(e,t){return k(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-"+N(t))}function F(e,t,i){k(i)?e[t]=i:e.dataset?e.dataset[t]=i:e.setAttribute("data-"+N(t),i)}var X=/\s\s*/,P=function(){var e=!1;if(o){var t=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});r.addEventListener("test",i,n),r.removeEventListener("test",i,n)}return e}();function B(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;t.trim().split(X).forEach(function(t){if(!P){var r=e.listeners;r&&r[t]&&r[t][i]&&(o=r[t][i],delete r[t][i],0===Object.keys(r[t]).length&&delete r[t],0===Object.keys(r).length&&delete e.listeners)}e.removeEventListener(t,o,n)})}function U(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;t.trim().split(X).forEach(function(t){if(n.once&&!P){var r=e.listeners,s=void 0===r?{}:r;o=function(){for(var r=arguments.length,a=Array(r),h=0;h<r;h++)a[h]=arguments[h];delete s[t][i],e.removeEventListener(t,o,n),i.apply(e,a)},s[t]||(s[t]={}),s[t][i]&&e.removeEventListener(t,s[t][i],n),s[t][i]=o,e.listeners=s}e.addEventListener(t,o,n)})}function Y(e,t,i){var n=void 0;return D(Event)&&D(CustomEvent)?n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,i),e.dispatchEvent(n)}function q(e){var t=e.rotate,i=e.scaleX,n=e.scaleY,o=e.translateX,r=e.translateY,s=[];y(o)&&0!==o&&s.push("translateX("+o+"px)"),y(r)&&0!==r&&s.push("translateY("+r+"px)"),y(t)&&0!==t&&s.push("rotate("+t+"deg)"),y(i)&&1!==i&&s.push("scaleX("+i+")"),y(n)&&1!==n&&s.push("scaleY("+n+")");var a=s.length?s.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}var H=r.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(r.navigator.userAgent);function W(e,t){var i=document.createElement("img");if(e.naturalWidth&&!H)return t(e.naturalWidth,e.naturalHeight),i;var n=document.body||document.documentElement;return i.onload=function(){t(i.width,i.height),H||n.removeChild(i)},i.src=e.src,H||(i.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(i)),i}function V(e){switch(e){case 2:return h;case 3:return a;case 4:return s;default:return""}}function Z(e,t){var i=e.pageX,n=e.pageY,o={endX:i,endY:n};return t?o:E({startX:i,startY:n},o)}var K={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var e=this.options,t=this.parent,i=void 0;e.inline&&(i={width:Math.max(t.offsetWidth,e.minWidth),height:Math.max(t.offsetHeight,e.minHeight)},this.parentData=i),!this.fulled&&i||(i=this.containerData),this.viewerData=E({},i)},renderViewer:function(){this.options.inline&&!this.fulled&&L(this.viewer,this.viewerData)},initList:function(){var e=this,t=this.element,i=this.options,n=this.list,o=[];T(this.images,function(t,n){var r=t.src,s=t.alt||function(e){return g(e)?e.replace(/^.*\//,"").replace(/[?&#].*$/,""):""}(r),a=i.url;g(a)?a=t.getAttribute(a):D(a)&&(a=a.call(e,t)),(r||a)&&o.push('<li><img src="'+(r||a)+'" role="button" data-action="view" data-index="'+n+'" data-original-url="'+(a||r)+'" alt="'+s+'"></li>')}),n.innerHTML=o.join(""),this.items=n.getElementsByTagName("li"),T(this.items,function(t){var n=t.firstElementChild;F(n,"filled",!0),i.loading&&I(t,"viewer-loading"),U(n,"load",function(n){i.loading&&M(t,"viewer-loading"),e.loadImage(n)},{once:!0})}),i.transition&&U(t,"viewed",function(){I(n,c)},{once:!0})},renderList:function(e){var t=e||this.index,i=this.items[t].offsetWidth||30,n=i+1;L(this.list,E({width:n*this.length},q({translateX:(this.viewerData.width-i)/2-n*t})))},resetList:function(){var e=this.list;e.innerHTML="",M(e,c),L(e,q({translateX:0}))},initImage:function(e){var t=this,i=this.options,n=this.image,o=this.viewerData,r=this.footer.offsetHeight,s=o.width,a=Math.max(o.height-r,r),h=this.imageData||{},l=void 0;this.imageInitializing={abort:function(){l.onload=null}},l=W(n,function(n,o){var r=n/o,l=s,c=a;t.imageInitializing=!1,a*r>s?c=s/r:l=a*r;var u={naturalWidth:n,naturalHeight:o,aspectRatio:r,ratio:(l=Math.min(.9*l,n))/n,width:l,height:c=Math.min(.9*c,o),left:(s-l)/2,top:(a-c)/2},d=E({},u);i.rotatable&&(u.rotate=h.rotate||0,d.rotate=0),i.scalable&&(u.scaleX=h.scaleX||1,u.scaleY=h.scaleY||1,d.scaleX=1,d.scaleY=1),t.imageData=u,t.initialImageData=d,e&&e()})},renderImage:function(e){var t=this,i=this.image,n=this.imageData;if(L(i,E({width:n.width,height:n.height,marginLeft:n.left,marginTop:n.top},q(n))),e)if(this.viewing&&this.options.transition){var o=function(){t.imageRendering=!1,e()};this.imageRendering={abort:function(){B(i,"transitionend",o)}},U(i,"transitionend",o,{once:!0})}else e()},resetImage:function(){if(this.viewing||this.viewed){var e=this.image;this.viewing&&this.viewing.abort(),e.parentNode.removeChild(e),this.image=null}}},G={bind:function(){var e=this.element,t=this.viewer;U(t,"click",this.onClick=this.click.bind(this)),U(t,"wheel mousewheel DOMMouseScroll",this.onWheel=this.wheel.bind(this)),U(t,"dragstart",this.onDragStart=this.dragstart.bind(this)),U(this.canvas,u,this.onPointerDown=this.pointerdown.bind(this)),U(e.ownerDocument,d,this.onPointerMove=this.pointermove.bind(this)),U(e.ownerDocument,f,this.onPointerUp=this.pointerup.bind(this)),U(e.ownerDocument,"keydown",this.onKeyDown=this.keydown.bind(this)),U(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.viewer;B(t,"click",this.onClick),B(t,"wheel mousewheel DOMMouseScroll",this.onWheel),B(t,"dragstart",this.onDragStart),B(this.canvas,u,this.onPointerDown),B(e.ownerDocument,d,this.onPointerMove),B(e.ownerDocument,f,this.onPointerUp),B(e.ownerDocument,"keydown",this.onKeyDown),B(window,"resize",this.onResize)}},J={click:function(e){var t=e.target,i=this.options,n=this.imageData;switch(j(t,"action")){case"mix":this.played?this.stop():i.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.hide();break;case"view":this.view(j(t,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(i.loop);break;case"play":this.play(i.fullscreen);break;case"next":this.next(i.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-n.scaleX||-1);break;case"flip-vertical":this.scaleY(-n.scaleY||-1);break;default:this.played&&this.stop()}},load:function(){var e=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var t=this.element,i=this.options,n=this.image,o=this.index,r=this.viewerData;M(n,"viewer-invisible"),i.loading&&M(this.canvas,"viewer-loading"),n.style.cssText="height:0;margin-left:"+r.width/2+"px;margin-top:"+r.height/2+"px;max-width:none!important;position:absolute;width:0;",this.initImage(function(){O(n,"viewer-move",i.movable),O(n,c,i.transition),e.renderImage(function(){e.viewed=!0,e.viewing=!1,D(i.viewed)&&U(t,"viewed",i.viewed,{once:!0}),Y(t,"viewed",{originalImage:e.images[o],index:o,image:n})})})},loadImage:function(e){var t=e.target,i=t.parentNode,n=i.offsetWidth||30,o=i.offsetHeight||50,r=!!j(t,"filled");W(t,function(e,i){var s=e/i,a=n,h=o;o*s>n?r?a=o*s:h=n/s:r?h=n/s:a=o*s,L(t,E({width:a,height:h},q({translateX:(n-a)/2,translateY:(o-h)/2})))})},keydown:function(e){var t=this.options;if(this.fulled&&t.keyboard)switch(e.keyCode||e.which||e.charCode){case 27:this.played?this.stop():t.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.prev(t.loop);break;case 38:e.preventDefault(),this.zoom(t.zoomRatio,!0);break;case 39:this.next(t.loop);break;case 40:e.preventDefault(),this.zoom(-t.zoomRatio,!0);break;case 48:case 49:e.ctrlKey&&(e.preventDefault(),this.toggle())}},dragstart:function(e){"img"===e.target.tagName.toLowerCase()&&e.preventDefault()},pointerdown:function(e){var t=this.options,i=this.pointers;if(this.viewed&&!this.showing&&!this.viewing&&!this.hiding){e.changedTouches?T(e.changedTouches,function(e){i[e.identifier]=Z(e)}):i[e.pointerId||0]=Z(e);var n=!!t.movable&&"move";Object.keys(i).length>1?n="zoom":"touch"!==e.pointerType&&"touchstart"!==e.type||!this.isSwitchable()||(n="switch"),this.action=n}},pointermove:function(e){var t=this.options,i=this.pointers,n=this.action,o=this.image;this.viewed&&n&&(e.preventDefault(),e.changedTouches?T(e.changedTouches,function(e){E(i[e.identifier],Z(e,!0))}):E(i[e.pointerId||0],Z(e,!0)),"move"===n&&t.transition&&C(o,c)&&M(o,c),this.change(e))},pointerup:function(e){var t=this.action,i=this.pointers;e.changedTouches?T(e.changedTouches,function(e){delete i[e.identifier]}):delete i[e.pointerId||0],t&&("move"===t&&this.options.transition&&I(this.image,c),this.action=!1)},resize:function(){var e=this;if(this.isShown&&!this.hiding&&(this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){e.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement)return void this.stop();T(this.player.getElementsByTagName("img"),function(t){U(t,"load",e.loadImage.bind(e),{once:!0}),Y(t,"load")})}},wheel:function(e){var t=this;if(this.viewed&&(e.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50);var i=Number(this.options.zoomRatio)||.1,n=1;e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*i,!0,e)}}},Q={show:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.element,i=this.options;if(i.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(e),this;if(D(i.show)&&U(t,"show",i.show,{once:!0}),!1===Y(t,"show")||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(M(n,"viewer-hide"),i.transition&&!e){var o=this.shown.bind(this);this.transitioning={abort:function(){B(n,"transitionend",o),M(n,l)}},I(n,c),n.offsetWidth,U(n,"transitionend",o,{once:!0}),I(n,l)}else I(n,l),this.shown();return this},hide:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.element,i=this.options;if(i.inline||this.hiding||!this.isShown&&!this.showing)return this;if(D(i.hide)&&U(t,"hide",i.hide,{once:!0}),!1===Y(t,"hide"))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var n=this.viewer;if(i.transition&&!e){var o=this.hidden.bind(this),r=function(){U(n,"transitionend",o,{once:!0}),M(n,l)};this.transitioning={abort:function(){this.viewed?B(this.image,"transitionend",r):B(n,"transitionend",o)}},this.viewed?(U(this.image,"transitionend",r,{once:!0}),this.zoomTo(0,!1,!1,!0)):r()}else M(n,l),this.hidden();return this},view:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t=Number(t)||0,!this.isShown)return this.index=t,this.show();if(this.hiding||this.played||t<0||t>=this.length||this.viewed&&t===this.index)return this;this.viewing&&this.viewing.abort();var i=this.element,n=this.options,o=this.title,r=this.canvas,s=this.items[t],a=s.querySelector("img"),h=j(a,"originalUrl"),l=a.getAttribute("alt"),c=document.createElement("img");if(c.src=h,c.alt=l,D(n.view)&&U(i,"view",n.view,{once:!0}),!1===Y(i,"view",{originalImage:this.images[t],index:t,image:c})||!this.isShown||this.hiding||this.played)return this;this.image=c,M(this.items[this.index],"viewer-active"),I(s,"viewer-active"),this.viewed=!1,this.index=t,this.imageData={},I(c,"viewer-invisible"),n.loading&&I(r,"viewer-loading"),r.innerHTML="",r.appendChild(c),this.renderList(),o.innerHTML="";var u=function(){var t=e.imageData;o.textContent=l+" ("+t.naturalWidth+" × "+t.naturalHeight+")"},d=void 0;return U(i,"viewed",u,{once:!0}),this.viewing={abort:function(){B(i,"viewed",u),c.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(B(c,"load",d),this.timeout&&clearTimeout(this.timeout))}},c.complete?this.load():(U(c,"load",d=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){M(c,"viewer-invisible"),e.timeout=!1},1e3)),this},prev:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.index-1;return t<0&&(t=e?this.length-1:0),this.view(t),this},next:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.length-1,i=this.index+1;return i>t&&(i=e?0:t),this.view(i),this},move:function(e,t){var i=this.imageData;return this.moveTo(x(e)?e:i.left+Number(e),x(t)?t:i.top+Number(t)),this},moveTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,i=this.imageData;if(e=Number(e),t=Number(t),this.viewed&&!this.played&&this.options.movable){var n=!1;y(e)&&(i.left=e,n=!0),y(t)&&(i.top=t,n=!0),n&&this.renderImage()}return this},zoom:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.imageData;return e=(e=Number(e))<0?1/(1-e):1+e,this.zoomTo(n.width*e/n.naturalWidth,t,i),this},zoomTo:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=this.options,a=this.pointers,h=this.imageData;if(y(e=Math.max(0,e))&&this.viewed&&!this.played&&(r||s.zoomable)){if(!r){var l=Math.max(.01,s.minZoomRatio),c=Math.min(100,s.maxZoomRatio);e=Math.min(Math.max(e,l),c)}o&&e>.95&&e<1.05&&(e=1);var u=h.naturalWidth*e,d=h.naturalHeight*e;if(o){var f=(t=this.viewer,{left:(i=t.getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:i.top+(window.pageYOffset-document.documentElement.clientTop)}),v=a&&Object.keys(a).length?function(e){var t=0,i=0,n=0;return T(e,function(e){var o=e.startX,r=e.startY;t+=o,i+=r,n+=1}),{pageX:t/=n,pageY:i/=n}}(a):{pageX:o.pageX,pageY:o.pageY};h.left-=(u-h.width)*((v.pageX-f.left-h.left)/h.width),h.top-=(d-h.height)*((v.pageY-f.top-h.top)/h.height)}else h.left-=(u-h.width)/2,h.top-=(d-h.height)/2;h.width=u,h.height=d,h.ratio=e,this.renderImage(),n&&this.tooltip()}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e)),this},rotateTo:function(e){var t=this.imageData;return y(e=Number(e))&&this.viewed&&!this.played&&this.options.rotatable&&(t.rotate=e,this.renderImage()),this},scaleX:function(e){return this.scale(e,this.imageData.scaleY),this},scaleY:function(e){return this.scale(this.imageData.scaleX,e),this},scale:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,i=this.imageData;if(e=Number(e),t=Number(t),this.viewed&&!this.played&&this.options.scalable){var n=!1;y(e)&&(i.scaleX=e,n=!0),y(t)&&(i.scaleY=t,n=!0),n&&this.renderImage()}return this},play:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var i=this.options,n=this.player,o=this.loadImage.bind(this),r=[],s=0,a=0;if(this.played=!0,this.onLoadWhenPlay=o,t&&this.requestFullscreen(),I(n,"viewer-show"),T(this.items,function(e,t){var h=e.querySelector("img"),u=document.createElement("img");u.src=j(h,"originalUrl"),u.alt=h.getAttribute("alt"),s+=1,I(u,"viewer-fade"),O(u,c,i.transition),C(e,"viewer-active")&&(I(u,l),a=t),r.push(u),U(u,"load",o,{once:!0}),n.appendChild(u)}),y(i.interval)&&i.interval>0){var h=function t(){e.playing=setTimeout(function(){M(r[a],l),I(r[a=(a+=1)<s?a:0],l),t()},i.interval)};s>1&&h()}return this},stop:function(){var e=this;if(!this.played)return this;var t=this.player;return this.played=!1,clearTimeout(this.playing),T(t.getElementsByTagName("img"),function(t){B(t,"load",e.onLoadWhenPlay)}),M(t,"viewer-show"),t.innerHTML="",this.exitFullscreen(),this},full:function(){var e=this,t=this.options,i=this.viewer,n=this.image,o=this.list;return!this.isShown||this.played||this.fulled||!t.inline?this:(this.fulled=!0,this.open(),I(this.button,"viewer-fullscreen-exit"),t.transition&&(M(o,c),this.viewed&&M(n,c)),I(i,"viewer-fixed"),i.setAttribute("style",""),L(i,{zIndex:t.zIndex}),this.initContainer(),this.viewerData=E({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){e.renderImage(function(){t.transition&&setTimeout(function(){I(n,c),I(o,c)},0)})}),this)},exit:function(){var e=this,t=this.options,i=this.viewer,n=this.image,o=this.list;return this.isShown&&!this.played&&this.fulled&&t.inline?(this.fulled=!1,this.close(),M(this.button,"viewer-fullscreen-exit"),t.transition&&(M(o,c),this.viewed&&M(n,c)),M(i,"viewer-fixed"),L(i,{zIndex:t.zIndexInline}),this.viewerData=E({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){e.renderImage(function(){t.transition&&setTimeout(function(){I(n,c),I(o,c)},0)})}),this):this},tooltip:function(){var e=this,t=this.options,i=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&t.tooltip?(i.textContent=Math.round(100*n.ratio)+"%",this.tooltipping?clearTimeout(this.tooltipping):t.transition?(this.fading&&Y(i,"transitionend"),I(i,"viewer-show"),I(i,"viewer-fade"),I(i,c),i.offsetWidth,I(i,l)):I(i,"viewer-show"),this.tooltipping=setTimeout(function(){t.transition?(U(i,"transitionend",function(){M(i,"viewer-show"),M(i,"viewer-fade"),M(i,c),e.fading=!1},{once:!0}),M(i,l),e.fading=!0):M(i,"viewer-show"),e.tooltipping=!1},1e3),this):this},toggle:function(){return 1===this.imageData.ratio?this.zoomTo(this.initialImageData.ratio,!0):this.zoomTo(1,!0),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=E({},this.initialImageData),this.renderImage()),this},update:function(){var e=this.element,t=this.options,i=this.isImg;if(i&&!e.parentNode)return this.destroy();var n=[];if(T(i?[e]:e.querySelectorAll("img"),function(e){t.filter?t.filter(e)&&n.push(e):n.push(e)}),!n.length)return this;if(this.images=n,this.length=n.length,this.ready){var o=[];if(T(this.items,function(e,t){var i=e.querySelector("img"),r=n[t];r?r.src!==i.src&&o.push(t):o.push(t)}),L(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var r=o.indexOf(this.index);r>=0?(this.viewed=!1,this.view(Math.max(this.index-(r+1),0))):I(this.items[this.index],"viewer-active")}}else this.image=null,this.viewed=!1,this.index=0,this.imageData=null,this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var e=this.element,t=this.options;return j(e,"viewer")?(this.destroyed=!0,this.ready?(this.played&&this.stop(),t.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):t.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),t.inline||B(e,"click",this.onStart),function(e,t){if(k(e[t]))try{delete e[t]}catch(i){e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch(i){e.dataset[t]=void 0}else e.removeAttribute("data-"+N(t))}(e,"viewer"),this):this}},_={open:function(){var e=this.body;I(e,"viewer-open"),e.style.paddingRight=this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0)+"px"},close:function(){var e=this.body;M(e,"viewer-open"),e.style.paddingRight=this.initialBodyPaddingRight},shown:function(){var e=this.element,t=this.options;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,D(t.shown)&&U(e,"shown",t.shown,{once:!0}),!1!==Y(e,"shown")&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var e=this.element,t=this.options;this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),I(this.viewer,"viewer-hide"),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(D(t.hidden)&&U(e,"hidden",t.hidden,{once:!0}),Y(e,"hidden"))},requestFullscreen:function(){var e=this.element.ownerDocument;if(this.fulled&&!e.fullscreenElement&&!e.mozFullScreenElement&&!e.webkitFullscreenElement&&!e.msFullscreenElement){var t=e.documentElement;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}},exitFullscreen:function(){if(this.fulled){var e=this.element.ownerDocument;e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitExitFullscreen&&e.webkitExitFullscreen()}},change:function(e){var t=this.options,i=this.pointers,n=i[Object.keys(i)[0]],o=n.endX-n.startX,r=n.endY-n.startY;switch(this.action){case"move":this.move(o,r);break;case"zoom":this.zoom(function(e){var t=E({},e),i=[];return T(e,function(e,n){delete t[n],T(t,function(t){var n=Math.abs(e.startX-t.startX),o=Math.abs(e.startY-t.startY),r=Math.abs(e.endX-t.endX),s=Math.abs(e.endY-t.endY),a=Math.sqrt(n*n+o*o),h=(Math.sqrt(r*r+s*s)-a)/a;i.push(h)})}),i.sort(function(e,t){return Math.abs(e)<Math.abs(t)}),i[0]}(i),!1,e);break;case"switch":this.action="switched",this.pointers={},Math.abs(o)>Math.abs(r)&&(o>1?this.prev(t.loop):o<-1&&this.next(t.loop))}T(i,function(e){e.startX=e.endX,e.startY=e.endY})},isSwitchable:function(){var e=this.imageData,t=this.viewerData;return this.length>1&&e.left>=0&&e.top>=0&&e.width<=t.width&&e.height<=t.height}},$=r.Viewer,ee=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,e),!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=E({},n,A(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.index=0,this.isImg=!1,this.length=0,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.isShown=!1,this.wheeling=!1,this.init()}return w(e,[{key:"init",value:function(){var e=this,t=this.element,i=this.options;if(!j(t,"viewer")){F(t,"viewer",this);var n="img"===t.tagName.toLowerCase(),o=[];if(T(n?[t]:t.querySelectorAll("img"),function(t){D(i.filter)?i.filter.call(e,t)&&o.push(t):o.push(t)}),o.length){this.isImg=n,this.length=o.length,this.images=o;var r=t.ownerDocument,s=r.body||r.documentElement;if(this.body=s,this.scrollbarWidth=window.innerWidth-r.documentElement.clientWidth,this.initialBodyPaddingRight=window.getComputedStyle(s).paddingRight,x(document.createElement("viewer").style.transition)&&(i.transition=!1),i.inline){var a=0,h=function(){if((a+=1)===e.length){var t=void 0;e.initializing=!1,e.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){e.delaying=!1,e.build()},0)}};this.initializing={abort:function(){T(o,function(e){e.complete||B(e,"load",h)})}},T(o,function(e){e.complete?h():U(e,"load",h,{once:!0})})}else U(t,"click",this.onStart=function(t){var i=t.target;"img"===i.tagName.toLowerCase()&&e.view(e.images.indexOf(i))})}}}},{key:"build",value:function(){if(!this.ready){var e=this.element,t=this.options,i=e.parentNode,n=document.createElement("div");n.innerHTML='<div class="viewer-container" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list"></ul></div></div><div class="viewer-tooltip"></div><div role="button" class="viewer-button" data-action="mix"></div><div class="viewer-player"></div></div>';var o=n.querySelector(".viewer-container"),r=o.querySelector(".viewer-title"),s=o.querySelector(".viewer-toolbar"),a=o.querySelector(".viewer-navbar"),h=o.querySelector(".viewer-button"),l=o.querySelector(".viewer-canvas");if(this.parent=i,this.viewer=o,this.title=r,this.toolbar=s,this.navbar=a,this.button=h,this.canvas=l,this.footer=o.querySelector(".viewer-footer"),this.tooltipBox=o.querySelector(".viewer-tooltip"),this.player=o.querySelector(".viewer-player"),this.list=o.querySelector(".viewer-list"),I(r,t.title?V(t.title):"viewer-hide"),I(a,t.navbar?V(t.navbar):"viewer-hide"),O(h,"viewer-hide",!t.button),t.backdrop&&(I(o,"viewer-backdrop"),t.inline||!0!==t.backdrop||F(l,"action","hide")),t.toolbar){var c=document.createElement("ul"),u=A(t.toolbar),d=v.slice(0,3),f=v.slice(7,9),p=v.slice(9);u||I(s,V(t.toolbar)),T(u?t.toolbar:v,function(e,i){var n=u&&A(e),o=u?N(i):e,r=n&&!x(e.show)?e.show:e;if(r&&(t.zoomable||-1===d.indexOf(o))&&(t.rotatable||-1===f.indexOf(o))&&(t.scalable||-1===p.indexOf(o))){var s=n&&!x(e.size)?e.size:e,a=n&&!x(e.click)?e.click:e,h=document.createElement("li");h.setAttribute("role","button"),I(h,"viewer-"+o),D(a)||F(h,"action",o),y(r)&&I(h,V(r)),-1!==["small","large"].indexOf(s)?I(h,"viewer-"+s):"play"===o&&I(h,"viewer-large"),D(a)&&U(h,"click",a),c.appendChild(h)}}),s.appendChild(c)}else I(s,"viewer-hide");if(!t.rotatable){var m=s.querySelectorAll('li[class*="rotate"]');I(m,"viewer-invisible"),T(m,function(e){s.appendChild(e)})}if(t.inline)I(h,"viewer-fullscreen"),L(o,{zIndex:t.zIndexInline}),"static"===window.getComputedStyle(i).position&&L(i,{position:"relative"}),i.insertBefore(o,e.nextSibling);else{I(h,"viewer-close"),I(o,"viewer-fixed"),I(o,"viewer-fade"),I(o,"viewer-hide"),L(o,{zIndex:t.zIndex});var w=t.container;g(w)&&(w=e.ownerDocument.querySelector(w)),w||(w=this.body),w.appendChild(o)}t.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,D(t.ready)&&U(e,"ready",t.ready,{once:!0}),!1!==Y(e,"ready")?this.ready&&t.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=$,e}},{key:"setDefaults",value:function(e){E(n,A(e)&&e)}}]),e}();E(ee.prototype,K,G,J,Q,_),t.default=ee},function(t,i){t.exports=e},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(6),s=h(r),a=h(i(5));function h(e){return e&&e.__esModule?e:{default:e}}i(4);var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.container=null,i.viewer=null,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"componentDidMount",value:function(){this.viewerInit()}},{key:"getViewer",value:function(){return{viewer:this.viewer,container:this.container}}},{key:"componentDidUpdate",value:function(){this.Viewer&&!this.isIdentical()&&this.viewerInit()}},{key:"componentWillUnmount",value:function(){this.viewer&&this.viewer.destroy()}},{key:"isIdentical",value:function(){var e=this.viewer.images||[];this.viewer.update();var t=this.viewer.images||[];return!e.length&&!t.length||e.length===t.length&&t.every(function(t){return e.some(function(e){return e===t})})}},{key:"viewerInit",value:function(){this.viewer&&this.viewer.destroy();var e=this.props,t=e.options,i=void 0===t?{}:t,o=e.children;this.viewer=new a.default(this.container,n({navbar:!(!Array.isArray(o)||!o.length)},i))}},{key:"render",value:function(){var e=this,t=this.props,i=(t.options,t.children),o=function(e,t){var i={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n]);return i}(t,["options","children"]);return s.default.createElement("div",n({ref:function(t){e.container=t}},o),i)}}]),t}();t.default=l}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("viewerjs"),require("react")):"function"==typeof define&&define.amd?define(["viewerjs","react"],t):"object"==typeof exports?exports["rc-viewer"]=t(require("viewerjs"),require("react")):e["rc-viewer"]=t(e.viewerjs,e.react)}(window,function(e,t){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var r=t.protocol+"//"+t.host,o=r+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var n,i=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(n=0===i.indexOf("//")?i:0===i.indexOf("/")?r+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")})}},function(e,t,r){var o,n,i={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===n&&(n=o.apply(this,arguments)),n}),s=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var r=function(e){return document.querySelector(e)}.call(this,e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}}(),l=null,c=0,p=[],u=r(0);function f(e,t){for(var r=0;r<e.length;r++){var o=e[r],n=i[o.id];if(n){n.refs++;for(var a=0;a<n.parts.length;a++)n.parts[a](o.parts[a]);for(;a<o.parts.length;a++)n.parts.push(g(o.parts[a],t))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(g(o.parts[a],t));i[o.id]={id:o.id,refs:1,parts:s}}}}function d(e,t){for(var r=[],o={},n=0;n<e.length;n++){var i=e[n],a=t.base?i[0]+t.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};o[a]?o[a].parts.push(s):r.push(o[a]={id:a,parts:[s]})}return r}function v(e,t){var r=s(e.insertInto);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=p[p.length-1];if("top"===e.insertAt)o?o.nextSibling?r.insertBefore(t,o.nextSibling):r.appendChild(t):r.insertBefore(t,r.firstChild),p.push(t);else if("bottom"===e.insertAt)r.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var n=s(e.insertInto+" "+e.insertAt.before);r.insertBefore(t,n)}}function h(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=p.indexOf(e);t>=0&&p.splice(t,1)}function b(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),w(t,e.attrs),v(e,t),t}function w(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})}function g(e,t){var r,o,n,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=c++;r=l||(l=b(t)),o=y.bind(null,r,a,!1),n=y.bind(null,r,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",w(t,e.attrs),v(e,t),t}(t),o=function(e,t,r){var o=r.css,n=r.sourceMap,i=void 0===t.convertToAbsoluteUrls&&n;(t.convertToAbsoluteUrls||i)&&(o=u(o));n&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var a=new Blob([o],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,r,t),n=function(){h(r),r.href&&URL.revokeObjectURL(r.href)}):(r=b(t),o=function(e,t){var r=t.css,o=t.media;o&&e.setAttribute("media",o);if(e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}.bind(null,r),n=function(){h(r)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var r=d(e,t);return f(r,t),function(e){for(var o=[],n=0;n<r.length;n++){var a=r[n];(s=i[a.id]).refs--,o.push(s)}e&&f(d(e,t),t);for(n=0;n<o.length;n++){var s;if(0===(s=o[n]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete i[s.id]}}}};var m,x=(m=[],function(e,t){return m[e]=t,m.filter(Boolean).join("\n")});function y(e,t,r,o){var n=r?"":o.css;if(e.styleSheet)e.styleSheet.cssText=x(t,n);else{var i=document.createTextNode(n),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r=function(e,t){var r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var n=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[r].concat(i).concat([n]).join("\n")}var a;return[r].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r}).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},n=0;n<this.length;n++){var i=this[n][0];"number"==typeof i&&(o[i]=!0)}for(n=0;n<e.length;n++){var a=e[n];"number"==typeof a[0]&&o[a[0]]||(r&&!a[2]?a[2]=r:r&&(a[2]="("+a[2]+") and ("+r+")"),t.push(a))}},t}},function(e,t,r){(e.exports=r(2)(!1)).push([e.i,'/*!\n * Viewer.js v1.0.0\n * https://github.com/fengyuanchen/viewerjs\n *\n * Copyright (c) 2015-2018 Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2018-04-01T05:32:30.097Z\n */.viewer-close:before,.viewer-flip-horizontal:before,.viewer-flip-vertical:before,.viewer-fullscreen-exit:before,.viewer-fullscreen:before,.viewer-next:before,.viewer-one-to-one:before,.viewer-play:before,.viewer-prev:before,.viewer-reset:before,.viewer-rotate-left:before,.viewer-rotate-right:before,.viewer-zoom-in:before,.viewer-zoom-out:before{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ+BEpNYDwKbpnQMeAw4m8HjQtM6Z9qa917zPQwFr3M5KgA6J5rTJCdFZJj9/lyvGhsDvwFNVuV2MhhjrK6b9bFiE+j1r87eBl4HDwCF7/U/k+ofAX5b/EXBv5JoLMuILzf3Ap6Z3EzgdqHMCuF7hcQf4HDgeoHnccncqdK/TvSDWffFXI/exICY/xZyqc6XLWF1UFZna4gJ7q8BsRvgd2/xXpo6P+D9dfT7PpECtA3cnWPM0GXGFZh/wgWltA+cDNC7X+AP4GzjZQe+k5dRxuYPeiuXU7e1qwLpDz7dFjXKRaSwuMLvAlG8zZlG+YmiK1HoFqT7wP2z+4Q45TfEGcMt01xLoNZEBTwRqD4BLpnMLeC1A41UmVxsXgXeBayV/Wx20rpTyrpnWRft7p6O/FdqzGrDukPNtkaMoMo3FBdBSQMOnYBCReyf05s126fU9ytfX98+mY54Kxnp7S9K3kj6U9KYdG0h6UdLbkh7poFXMfUnSOyVvL0h6VtIXHbS6nOP+s/Zm9mvyXW1uuC9ohZ72E9uDmXWLJOB1GxsH+DxPftsB8B6wlGDN02TAkxG6+4D3TWsbeC5CS8CDFce+AW500LhhOW2020TRjK3b21HEmgti9m0RonxbdMZeVzV+/4tF3cBpP7E9mKHNL5q8h5g0eYsCMQz0epq8gQrwMXAgcs0FGXGFRcB9wCemF9PkbYqM/Bas7fxLwNeJPdTdpo4itQti8lPMqTpXuozVRVXPpbHI3KkNTB1NfkL81j2mvhDp91HgV9MKuRIqrykj3WPq4rHyL+axj8/qGPmTqi6F9YDlHOvJU6oYcTsh/TYSzWmTE6JT19CtLTJt32D6CmHe0eQn1O8z5AXgT4sx4Vcu0/EQecMydB8z0hUWkTd2t4CrwNEePqMBcAR4mrBbwyXLPWJa8zrXmmLEhNBmfpkuY2102xxrih+pb+ieAb6vGhuA97UcJ5KR8gZ77K+99xxeYBzH6Q3/Z0fHcXrDC4zjOL3hBcZxnN74F+zlvXFWXF9PAAAAAElFTkSuQmCC");background-repeat:no-repeat;color:transparent;display:block;font-size:0;height:20px;line-height:0;width:20px}.viewer-zoom-in:before{background-position:0 0;content:"Zoom In"}.viewer-zoom-out:before{background-position:-20px 0;content:"Zoom Out"}.viewer-one-to-one:before{background-position:-40px 0;content:"One to One"}.viewer-reset:before{background-position:-60px 0;content:"Reset"}.viewer-prev:before{background-position:-80px 0;content:"Previous"}.viewer-play:before{background-position:-100px 0;content:"Play"}.viewer-next:before{background-position:-120px 0;content:"Next"}.viewer-rotate-left:before{background-position:-140px 0;content:"Rotate Left"}.viewer-rotate-right:before{background-position:-160px 0;content:"Rotate Right"}.viewer-flip-horizontal:before{background-position:-180px 0;content:"Flip Horizontal"}.viewer-flip-vertical:before{background-position:-200px 0;content:"Flip Vertical"}.viewer-fullscreen:before{background-position:-220px 0;content:"Enter Full Screen"}.viewer-fullscreen-exit:before{background-position:-240px 0;content:"Exit Full Screen"}.viewer-close:before{background-position:-260px 0;content:"Close"}.viewer-container{bottom:0;direction:ltr;font-size:0;left:0;line-height:0;overflow:hidden;position:absolute;right:0;-webkit-tap-highlight-color:transparent;top:0;-webkit-touch-callout:none;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.viewer-container::-moz-selection,.viewer-container ::-moz-selection{background-color:transparent}.viewer-container::selection,.viewer-container ::selection{background-color:transparent}.viewer-container img{display:block;height:auto;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.viewer-canvas{bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.viewer-canvas>img{height:auto;margin:15px auto;max-width:90%!important;width:auto}.viewer-footer{bottom:0;left:0;overflow:hidden;position:absolute;right:0;text-align:center}.viewer-navbar{background-color:rgba(0,0,0,.5);overflow:hidden}.viewer-list{box-sizing:content-box;height:50px;margin:0;overflow:hidden;padding:1px 0}.viewer-list>li{color:transparent;cursor:pointer;float:left;font-size:0;height:50px;line-height:0;opacity:.5;overflow:hidden;transition:opacity .15s;width:30px}.viewer-list>li:hover{opacity:.75}.viewer-list>li+li{margin-left:1px}.viewer-list>.viewer-loading{position:relative}.viewer-list>.viewer-loading:after{border-width:2px;height:20px;margin-left:-10px;margin-top:-10px;width:20px}.viewer-list>.viewer-active,.viewer-list>.viewer-active:hover{opacity:1}.viewer-player{background-color:#000;bottom:0;cursor:none;display:none;right:0}.viewer-player,.viewer-player>img{left:0;position:absolute;top:0}.viewer-toolbar ul{display:inline-block;margin:0 auto 5px;overflow:hidden;padding:3px 0}.viewer-toolbar li{background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;float:left;height:24px;overflow:hidden;transition:background-color .15s;width:24px}.viewer-toolbar li:hover{background-color:rgba(0,0,0,.8)}.viewer-toolbar li:before{margin:2px}.viewer-toolbar li+li{margin-left:1px}.viewer-toolbar .viewer-small{height:18px;margin-bottom:3px;margin-top:3px;width:18px}.viewer-toolbar .viewer-small:before{margin:-1px}.viewer-toolbar .viewer-large{height:30px;margin-bottom:-3px;margin-top:-3px;width:30px}.viewer-toolbar .viewer-large:before{margin:5px}.viewer-tooltip{background-color:rgba(0,0,0,.8);border-radius:10px;color:#fff;display:none;font-size:12px;height:20px;left:50%;line-height:20px;margin-left:-25px;margin-top:-10px;position:absolute;text-align:center;top:50%;width:50px}.viewer-title{color:#ccc;display:inline-block;font-size:12px;line-height:1;margin:0 5% 5px;max-width:90%;opacity:.8;overflow:hidden;text-overflow:ellipsis;transition:opacity .15s;white-space:nowrap}.viewer-title:hover{opacity:1}.viewer-button{background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;height:80px;overflow:hidden;position:absolute;right:-40px;top:-40px;transition:background-color .15s;width:80px}.viewer-button:focus,.viewer-button:hover{background-color:rgba(0,0,0,.8)}.viewer-button:before{bottom:15px;left:15px;position:absolute}.viewer-fixed{position:fixed}.viewer-open{overflow:hidden}.viewer-show{display:block}.viewer-hide{display:none}.viewer-backdrop{background-color:rgba(0,0,0,.5)}.viewer-invisible{visibility:hidden}.viewer-move{cursor:move;cursor:-webkit-grab;cursor:grab}.viewer-fade{opacity:0}.viewer-in{opacity:1}.viewer-transition{transition:all .3s}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.viewer-loading:after{-webkit-animation:a 1s linear infinite;animation:a 1s linear infinite;border:4px solid hsla(0,0%,100%,.1);border-left-color:hsla(0,0%,100%,.5);border-radius:50%;content:"";display:inline-block;height:40px;left:50%;margin-left:-20px;margin-top:-20px;position:absolute;top:50%;width:40px;z-index:1}@media (max-width:767px){.viewer-hide-xs-down{display:none}}@media (max-width:991px){.viewer-hide-sm-down{display:none}}@media (max-width:1199px){.viewer-hide-md-down{display:none}}',""])},function(e,t,r){var o=r(3);"string"==typeof o&&(o=[[e.i,o,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(1)(o,n);o.locals&&(e.exports=o.locals)},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),i=r(6),a=l(i),s=l(r(5));function l(e){return e&&e.__esModule?e:{default:e}}r(4);var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.container=null,r.viewer=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),n(t,[{key:"componentDidMount",value:function(){this.viewerInit()}},{key:"getViewer",value:function(){return{viewer:this.viewer,container:this.container}}},{key:"componentDidUpdate",value:function(){this.Viewer&&!this.isIdentical()&&this.viewerInit()}},{key:"componentWillUnmount",value:function(){this.viewer&&this.viewer.destroy()}},{key:"isIdentical",value:function(){var e=this.viewer.images||[];this.viewer.update();var t=this.viewer.images||[];return!e.length&&!t.length||e.length===t.length&&t.every(function(t){return e.some(function(e){return e===t})})}},{key:"viewerInit",value:function(){this.viewer&&this.viewer.destroy();var e=this.props,t=e.options,r=void 0===t?{}:t,n=e.children;this.viewer=new s.default(this.container,o({navbar:!(!Array.isArray(n)||!n.length)},r))}},{key:"render",value:function(){var e=this,t=this.props,r=(t.options,t.children),n=function(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}(t,["options","children"]);return a.default.createElement("div",o({ref:function(t){e.container=t}},n),r)}}]),t}();t.default=c}])}); |
{ | ||
"name": "rc-viewer", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Image viewer component for react, supports rotation, scale, zoom and so on, based on viewer.js", | ||
@@ -42,4 +42,4 @@ "main": "dist/rc-viewer.js", | ||
"webpack": "^4.8.3", | ||
"webpack-cli": "^2.1.3" | ||
"webpack-cli": "^2.1.3" | ||
} | ||
} |
@@ -1,53 +0,53 @@ | ||
import React, { Component } from 'react'; | ||
import React, { Component } from 'react' | ||
import Viewer from 'viewerjs'; | ||
import 'viewerjs/dist/viewer.min.css'; | ||
import Viewer from 'viewerjs' | ||
import 'viewerjs/dist/viewer.min.css' | ||
class ImgPreview extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.container = null; | ||
this.viewer = null; | ||
constructor (props) { | ||
super(props) | ||
this.container = null | ||
this.viewer = null | ||
} | ||
componentDidMount() { | ||
this.viewerInit(); | ||
componentDidMount () { | ||
this.viewerInit() | ||
} | ||
getViewer() { | ||
getViewer () { | ||
return { | ||
viewer:this.viewer, | ||
viewer: this.viewer, | ||
container: this.container | ||
} | ||
} | ||
componentDidUpdate() { | ||
if (!this.Viewer || this.isIdentical()) return; | ||
this.viewerInit(); | ||
componentDidUpdate () { | ||
if (!this.Viewer || this.isIdentical()) return | ||
this.viewerInit() | ||
} | ||
componentWillUnmount() { | ||
if (this.viewer)this.viewer.destroy(); | ||
componentWillUnmount () { | ||
if (this.viewer) this.viewer.destroy() | ||
} | ||
isIdentical() { | ||
const imgarr =this.viewer.images || []; | ||
this.viewer.update(); | ||
const imgarr2 =this.viewer.images || []; | ||
if (!imgarr.length && !imgarr2.length) return true; | ||
if (imgarr.length !== imgarr2.length) return false; | ||
return imgarr2.every(img => imgarr.some(img2 => img2 === img)); | ||
isIdentical () { | ||
const imgarr = this.viewer.images || [] | ||
this.viewer.update() | ||
const imgarr2 = this.viewer.images || [] | ||
if (!imgarr.length && !imgarr2.length) return true | ||
if (imgarr.length !== imgarr2.length) return false | ||
return imgarr2.every(img => imgarr.some(img2 => img2 === img)) | ||
} | ||
viewerInit() { | ||
if (this.viewer)this.viewer.destroy(); | ||
const { options = {}, children } = this.props; | ||
viewerInit () { | ||
if (this.viewer) this.viewer.destroy() | ||
const { options = {}, children } = this.props | ||
this.viewer = new Viewer(this.container, { | ||
navbar: !!(Array.isArray(children) && children.length), | ||
...options, | ||
}); | ||
...options | ||
}) | ||
} | ||
render() { | ||
const { options = {}, children, ...others } = this.props; | ||
render () { | ||
const { options = {}, children, ...others } = this.props | ||
return ( | ||
<div ref={(container) => { this.container = container; }} {...others}> | ||
<div ref={(container) => { this.container = container }} {...others}> | ||
{children} | ||
</div> | ||
); | ||
) | ||
} | ||
} | ||
export default ImgPreview; | ||
export default ImgPreview |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34500
51
1