Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mxssfd/img-zoom

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mxssfd/img-zoom - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7

0

lib-es/index.js

@@ -0,0 +0,0 @@ /*import {

@@ -0,0 +0,0 @@ export const style = `

6

lib-umd/index.js
/*!
* ImgZoom v1.2.5
* ImgZoom v1.2.6
* Author: dyh
* Documentation: https://github.com/mengxinssfd/img-zoom#readme
* Date: 2021-11-30
* Date: 2024-5-4
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ImgZoom=e():t.ImgZoom=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}([function(t,e,n){var r=n(11),o=n(12),i=n(8),a=n(13);t.exports=function(t,e){return r(t)||o(t,e)||i(t,e)||a()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(17)},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=n=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),n(e)}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(14),o=n(15),i=n(8),a=n(16);t.exports=function(t){return r(t)||o(t)||i(t)||a()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function n(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(9);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if(null==t)throw new TypeError("Cannot destructure undefined")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(9);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new L(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return S()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=x(a,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=s(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(t,n,a),i}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function d(){}function p(){}var h={};u(h,o,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(_([])));m&&m!==e&&n.call(m,o)&&(h=m);var y=p.prototype=f.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var r;this._invoke=function(o,i){function a(){return new e((function(r,a){!function r(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}(o,i,r,a)}))}return r=r?r.then(a,a):a()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function _(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=p,u(y,"constructor",p),u(p,"constructor",d),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},w(g.prototype),u(g.prototype,i,(function(){return this})),t.AsyncIterator=g,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new g(c(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(y),u(y,a,"Generator"),u(y,o,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return at}));var r=n(6),o=n.n(r),i=n(7),a=n.n(i),u=(n(2),n(3)),c=n.n(u),s=n(0),l=n.n(s),f=n(4),d=n.n(f);n(5),n(1),n(10);function p(t,e,n){for(var r in t){if(t.hasOwnProperty(r))if(!1===e(t[r],r,t))return!1}return n&&n(),!0}function h(t,e,n){var r=n||function(t){return t};return e.reduce((function(e,n){return t.hasOwnProperty(n)&&(e[n]=r(t[n],n,t)),e}),{})}function v(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.forEach((function(e){p(e,(function(e,n){t[n]=e}))})),t}function m(t){var e=c()(t);return"object"!==e?e:Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function y(t){return"array"===m(t)}function w(t){var e=m(t);if("string"===e)return!0;if(["null","undefined","number","boolean"].indexOf(e)>-1)return!1;var n=!!t&&"length"in t&&t.length;return"function"!==e&&t!==window&&("array"===e||0===n||x(n)&&n>0&&n-1 in t)}function g(t){return"string"===m(t)}function x(t){return"number"===m(t)}function b(t){return"function"===m(t)}function E(t){return x(t)&&t!=t}function L(t){var e,n=t.start,r=void 0===n?0:n,o=t.end,i=t.len,a=t.fill,u=r;switch(i&&o?u=Math.min(r+i,o):(void 0!==i&&(u=r+i),void 0!==o&&(u=o)),m(a)){case"function":e=a;break;case"undefined":case"null":e=function(t){return t};break;default:e=function(){return a}}for(var c=[],s=r,l=0;s<u;s++,l++)c.push(e(s,l));return c}function _(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t||this,o=r.length,i=n;i<o;i++){var a=r[i];if("function"==typeof e){if(e(a,i,r))return!0}else if(a===e)return!0;if(E(a)&&E(e))return!0}return!1}function S(t,e){if(!t.length)return t;for(var n=e||function(t,e){return t===e||E(t)&&E(e)},r=[t[0]],o=function(e){var o=t[e];if(r.some((function(t){return n(t,o)})))return"continue";r.push(o)},i=1;i<t.length;i++)o(i);return r}var M=["零","一","二","三","四","五","六","七","八","九"],T=["十","百","千"],k=[""].concat(T,["万"],T,["亿"]),j=k.length,O=function t(e){var n=~~e,r="",o=0;if(e>=0&&e<10)return t.numbers[e];for(;n>=1&&o<j;){var i=t.units[o],a=t.numbers[n%10];a!==t.numbers[0]&&(r=i+r),1===n&&1===o||(r=a+r),n=~~(n/10),o++}return r.replace(/(零+$)|((零)\3+)/g,"$3")};O.units=d()(k),O.numbers=[].concat(M);var I=function t(e){if(new RegExp("([^".concat(t.units.join()+t.numbers.join(),"])")).test(e))throw new TypeError("发现不符合规则的字符(必须在units和numbers里存在的字符):"+RegExp.$1);return e.split(new RegExp("[".concat(t.units[4]).concat(t.units[8],"]"),"g")).map((function(e){for(var n=0,r=1,o=e.length-1;o>-1;o--){var i=e[o],a=t.numbers.indexOf(i);a>0&&(n+=a*r);var u=t.units.indexOf(i);r=u>0?Math.pow(10,u):r}return e[0]===t.units[1]&&(n+=10),n})).reverse().reduce((function(t,e,n){return t+Math.pow(1e4,n)*e}),0)};function P(t,e){if(e<0||e*t.length>P.MAX_STR_LENGTH)throw new RangeError("strRepeat Invalid repeatCount value");var n="";if(""===t)return"";for(;e-- >0;)n+=t;return n}I.units=d()(k),I.numbers=[].concat(M),P.MAX_STR_LENGTH=536870912;var A=function t(){var e,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd hh:mm:ss",o=arguments.length>1?arguments[1]:void 0,i=o||this,a={"M+":i.getMonth()+1,"d+":i.getDate(),"h+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),q:(e=i,n=Math.floor((e.getMonth()+3)/3)-1,t.seasonText[n]),"S+":i.getMilliseconds(),w:function(e){var n=e.getDay();return t.weekText&&t.weekText.length||(t.weekText=L({end:7,fill:function(t,e){return 0===e?"日":O(e)}})),t.weekText[n]}(i)};for(var u in/(y+)/.test(r)&&(r=r.replace(RegExp.$1,(i.getFullYear()+"").substr(4-RegExp.$1.length))),a)if(new RegExp("("+u+")").test(r)){var c=RegExp.$1,s=a[u],l=1===c.length?s:("00"+s).substr(String(s).length);r=r.replace(c,l)}return r};A.weekText=[],A.seasonText=["春","夏","秋","冬"];var z=Function("return this")();var C=void 0===z.HTMLElement?function(t){return t&&"object"===c()(t)&&1===t.nodeType&&"string"==typeof t.nodeName}:function(t){return t instanceof HTMLElement};function N(t,e){return C(e)&&e.nodeName===t.toUpperCase()}function V(){return"ontouchstart"in window}function R(t){return"nodelist"===m(t)}var F,D,G;function H(t,e){var n=l()(t,2),r=n[0],o=n[1],i=l()(e,2),a=r-i[0],u=o-i[1];return Math.sqrt(a*a+u*u)}function q(t){var e=t.el,n=t.onDown,r=t.onMove,o=t.onUp,i=t.capture,a=void 0===i?{down:!1,up:!0,move:!1}:i,u=e;if(!C(e))if(g(e)){if(!(u=document.querySelector(e)))throw new Error("element not found!")}else u=window;var c,s={x:0,y:0},l={x:0,y:0};function f(t){var e={x:t.screenX,y:t.screenY};return e.x=~~e.x,e.y=~~e.y,e}function d(t){var e=(["touchcancel","touchend"].indexOf(t.type)>-1?t.changedTouches:t.touches)[0],n={x:e.clientX,y:e.clientY};return n.x=~~n.x,n.y=~~n.y,n}function p(t,e){if(!(t.touches&&t.touches.length>1)){l=(c="mouse"===e?f:d)(t),s=l;var r=void 0;return n&&b(n)&&(r=n.call(this,t,l)),r}w()}function h(t){var e=c(t),n=void 0;return r&&b(r)&&(n=r.call(this,t,e,s,l)),s=e,n}function v(t){var e=c(t),n=void 0;return s=e,o&&b(o)&&(n=o.call(this,t,e,l)),w(),n}function m(t){var e=p.call(this,t,"mouse");return window.addEventListener("mousemove",h,a.move),window.addEventListener("mouseup",v,a.up),e}function y(t){var e=p.call(this,t,"touch");return window.addEventListener("touchmove",h,a.move),window.addEventListener("touchend",v,a.up),window.addEventListener("touchcancel",v,a.up),e}function w(){window.removeEventListener("mousemove",h,a.move),window.removeEventListener("mouseup",v,a.up),window.removeEventListener("touchmove",h,a.move),window.removeEventListener("touchend",v,a.up),window.removeEventListener("touchcancel",v,a.up)}return u.addEventListener("mousedown",m,a.down),u.addEventListener("touchstart",y,a.down),function(){u.removeEventListener("mousedown",m,a.down),u.removeEventListener("touchstart",y,a.down),w()}}function Y(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.el,r=void 0===n?window:n,o=e.capture,i=void 0===o?{down:!1,up:!0,move:!1}:o,a={el:r,capture:i},u=function(t){a.onDown=t},c=function(t){a.onMove=t},s=function(t){a.onUp=t};return t({onDown:u,onMove:c,onUp:s}),q(a)}function $(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{down:!1,up:!0,move:!1},r=t;if(!C(t))if(g(t)){if(!(r=document.querySelector(t)))throw new Error("element not found!")}else r=window;var o=0;function i(t){var e=t[0],n=t[1];return H([e.pageX,e.pageY],[n.pageX,n.pageY])}function a(t){t.touches.length<2||e(+i(t.touches).toFixed(2),o)}function u(t){s()}function c(t){t.touches.length<2||(window.addEventListener("touchmove",a,n.move),window.addEventListener("touchend",u,n.up),window.addEventListener("touchcancel",u,n.up),o=+i(t.touches).toFixed(2))}function s(){window.removeEventListener("touchmove",a,n.move),window.removeEventListener("touchend",u,n.up),window.removeEventListener("touchcancel",u,n.up)}function l(){r.removeEventListener("touchstart",c,n.down),s()}return r.addEventListener("touchstart",c,n.down),l}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(F||(F={}));var U=null!==(G=null===(D=null==z?void 0:z.document)||void 0===D?void 0:D.createElement("div").style)&&void 0!==G?G:{},X=function(){var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t){if(void 0!==U[t[e]])return e}return!1}();function Z(){var t;return!!(null===(t=null==z?void 0:z.document)||void 0===t?void 0:t.documentElement.classList)}function W(t){if(!t)return[];var e=t;return g(t)&&(e=[t.trim()]),e.reduce((function(t,e,n){var r=e.trim().split(/ +/);return t.push.apply(t,d()(r)),t}),[])}Z();var B=Z()?function(t,e){var n=W(e),r=t.classList;return n.forEach((function(t){return r.add(t)})),t.className}:function(t,e){var n=W(e),r=t.className+" "+n.join(" ");return n=(n=S(n=r.split(" "))).filter((function(t){return Boolean(t)})),t.className=n.join(" "),t.className};var J=Z()?function(t,e){return W(e).forEach((function(e){t.classList.remove(e)})),t.className}:function(t,e){var n=W(e),r=S(t.className.split(/ +/).filter((function(t){return!_(n,t)})));return t.className=r.join(" ")};function K(t){return!1===X?null:"standard"===X?t:X+t.charAt(0).toUpperCase()+t.substr(1)}function Q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement(t),r=e.attrs,o=void 0===r?{}:r,i=e.props,a=void 0===i?{}:i,u=e.parent,s=e.children;if(p(a,(function(t,e,r){var o="object"===c()(t);"style"===e&&o?v(n.style,t):n[e]=t})),p(o,(function(t,e,r){var o="object"===c()(t);n.setAttribute(e,o?JSON.stringify(t):t)})),(y(s)||R(s))&&s.forEach((function(t){return n.appendChild(t)})),u)if(C(u))u.appendChild(n);else if(g(u)){var l=document.querySelector(u);if(!l)throw new TypeError("createHtmlElement param 'parent' => \"".concat(u,'" not founded'));l.appendChild(n)}return n}var tt=Q;var et="\n.img-zoom-wrapper {\n z-index: 10000;\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n cursor: zoom-out;\n}\n.img-zoom-wrapper.hide {\n display: none;\n}\n.img-zoom-wrapper .img-zoom-view {\n z-index: 1000000;\n position: fixed;\n left: 50%;\n top: 50%;\n display: block;\n width: auto;\n height: auto;\n cursor: move;\n -webkit-transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n -o-transform: translate(-50%, -50%);\n -ms-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n user-select: none;\n border: none;\n outline: none;\n}\n".replace(/[\n\r]/g,""),nt=K("transform"),rt={max:10,min:.1,step:.1,default:1},ot={triggerEl:".img-zoom",isClickViewImgClose:!1,dataset:"data-img-zoom"},it=function(){},at=function(){function t(e){o()(this,t),this.needCancelEventList=[];var n=v({},ot,e||{});n.scale=v({},rt,n.scale||{}),this.options=n;var r=this.options.scale,i=r.min,a=r.max,u=r.default,c=r.step;if(a<i)throw new Error("scale.max不能小于scale.min");if(u<i)throw new Error("scale.default不能小于scale.min");if(u>a)throw new Error("scale.default不能大于scale.max");if(i<=0)throw new Error("scale.min不能小于等于0");c>a&&console.warn("scale.step已大于scale.max"),this.init()}return a()(t,[{key:"init",value:function(){this.initView(),this.addInitViewEventListener(),this.initTrigger()}},{key:"setImg",value:function(t){var e=this;this.scale=this.options.scale.default,this.zoomImg.src=t,J(this.wrapper,"hide");var n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=t;if(g(t)){if(!(e=document.querySelector(t)))throw new Error("el not found")}else t===window&&(e=document.body.scrollTop?document.body:document.documentElement);var n=h(getComputedStyle(e),["marginTop","overflow"]),r=e.scrollTop;return e.scrollTop=0,e.style.overflow="hidden",e.style.marginTop=-r+parseInt(n.marginTop)+"px",function(){v(e.style,n),e.scrollTop=r}}(window);this.noScrollCanceller=function(){e.noScrollCanceller=void 0,n()},this.resetViewScaleAndPosition()}},{key:"initTrigger",value:function(){var t=this,e=function(e){var n=e.target,r=n.getAttribute(t.options.dataset);!r&&N("IMG",n)&&(r=e.target.src),r&&t.setImg(r)},n=this.options.triggerEl,r=w(n)?n:[n],o=this.needCancelEventList;Array.prototype.forEach.call(r,(function(t){C(t)&&(t.addEventListener("click",e),o.push((function(){t.removeEventListener("click",e)}))),g(t)&&o.push(function(t,e,n,r){var o;function i(t){t=t||window.event,_(C(n)?[n]:document.querySelectorAll(n),t.target)&&r(t)}return null===(o=t?C(t)?t:document.querySelector(t):document.documentElement)?null:(o.addEventListener(e,i),function(){o.removeEventListener(e,i)})}(null,"click",t,e))}));var i=function(t,e){var n,r,o,i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],u=!0,c=function(){clearTimeout(i),i=void 0},s=function t(){i&&c(),n=this;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];return r=l,u&&a?(t.flush(),u=!1,i=setTimeout((function(){u=!0}),e),o):(i=setTimeout((function(){c(),t.flush(),u=!0}),e),o)};return s.cancel=c,s.flush=function(){return o=t.apply(n,r),n=r=void 0,o},s}((function(){it("resize"),t.resetViewScaleAndPosition(),t.saveViewPositionFromMatrix()}),100);window.addEventListener("resize",i),this.needCancelEventList.push((function(){window.removeEventListener("resize",i)}))}},{key:"resetViewScaleAndPosition",value:function(){this.zoomImg.style[nt]="translate(-50%, -50%) scale(".concat(this.scale,")")}},{key:"getViewPosition",value:function(){var t=window.innerHeight||document.documentElement.clientHeight,e=window.innerWidth||document.documentElement.clientWidth,n=this.zoomImg,r=n.offsetWidth,o=n.offsetHeight;it(t,e,r,o),this.left=(t-r)/2,this.top=(e-o)/2}},{key:"getZoomImgStyleMatrixVal",value:function(){var t=getComputedStyle(this.zoomImg)[nt];return(/matrix\(([\d\\.,\- ]+)\)/.test(t)?RegExp.$1:"0,0,0,0,0,0").split(/, ?/)}},{key:"saveViewPositionFromMatrix",value:function(){var t=this.getZoomImgStyleMatrixVal();this.left=Number(t[4])||0,this.top=Number(t[5])||0}},{key:"setViewScaleAndPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.scale,n=this.getZoomImgStyleMatrixVal();n[0]=n[3]=e,n[4]=this.left,n[5]=this.top,this.zoomImg.style[nt]="".concat(t&&V()?"translateZ(0) ":"","matrix(").concat(n.join(", "),")")}},{key:"initView",value:function(){var t=this;tt("style",{props:{innerHTML:et},parent:document.head});var e=tt("img",{props:{className:"img-zoom-view",draggable:!1,onclick:function(){},onload:function(){t.saveViewPositionFromMatrix()}},attrs:{ondragstart:"return false"}});this.wrapper=tt("div",{props:{className:"img-zoom-wrapper hide"},children:[e],parent:document.body}),this.zoomImg=e}},{key:"setScale",value:function(t){var e=this.options.scale;this.scale=Math.max(e.min,Math.min(t,e.max)),this.setViewScaleAndPosition()}},{key:"scaleIncrease",value:function(){var t=this.options.scale,e=this.scale+t.step;this.setScale(e)}},{key:"scaleDecrease",value:function(){var t=this.options.scale,e=this.scale-t.step;this.setScale(e)}},{key:"addInitViewEventListener",value:function(){var t=this,e=arguments,n=this.wrapper,r=this.zoomImg,o=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(n){if(!e||!V())return it("wrapper click"),t.noScrollCanceller&&t.noScrollCanceller(),B(t.wrapper,"hide"),n.stopPropagation(),n.preventDefault(),!1}};n.addEventListener("mouseup",o()),n.addEventListener("touchend",o(!0)),n.addEventListener("touchcancel",o(!0)),n.addEventListener("wheel",(function(e){return(e=e||window.event).deltaY>0?t.scaleDecrease():t.scaleIncrease(),e.stopPropagation(),e.preventDefault(),!1}));var i=Q("div",{props:{style:{position:"fixed",zIndex:"11111111111111111",top:"0",left:"0",background:"white",padding:"20px"}}});$(r,(function(e,n){t.setScale(t.scale/n*e),i.innerText="".concat(e," / ").concat(n," / ").concat(t.scale)})),Y((function(n){var r=n.onMove,o=n.onDown,i=n.onUp;o((function(t){return it(e),t.stopPropagation(),t.preventDefault(),!1})),r((function(e,n,r,o){var i=n.x,a=n.y,u=~~(i-r.x),c=~~(a-r.y);t.left+=u,t.top+=c,t.setViewScaleAndPosition(!0)})),i((function(e,n,r){if(t.setViewScaleAndPosition(),!t.options.isClickViewImgClose||n.x!==r.x&&n.y!==r.y)return e.stopPropagation(),e.preventDefault(),!1}))}),{el:r})}},{key:"destroy",value:function(){this.needCancelEventList.forEach((function(t){return t()})),this.wrapper.parentNode.removeChild(this.wrapper)}}]),t}()}]).default}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ImgZoom=e():t.ImgZoom=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}([function(t,e,n){var r=n(11),o=n(12),i=n(8),u=n(13);t.exports=function(t,e){return r(t)||o(t,e)||i(t,e)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){t.exports=n(17)},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(14),o=n(15),i=n(8),u=n(16);t.exports=function(t){return r(t)||o(t)||i(t)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function n(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var u=t.apply(e,r);function a(t){n(u,o,i,a,c,"next",t)}function c(t){n(u,o,i,a,c,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(9);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(null==t)throw new TypeError("Cannot destructure undefined")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(9);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),u=new L(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return _()}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=s(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(t,n,u),i}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function d(){}function p(){}var h={};a(h,o,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(S([])));m&&m!==e&&n.call(m,o)&&(h=m);var y=p.prototype=f.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var r;this._invoke=function(o,i){function u(){return new e((function(r,u){!function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=p,a(y,"constructor",p),a(p,"constructor",d),d.displayName=a(p,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a(t,u,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},w(g.prototype),a(g.prototype,i,(function(){return this})),t.AsyncIterator=g,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(e,n,r,o),i);return t.isGeneratorFunction(n)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(y),a(y,u,"Generator"),a(y,o,(function(){return this})),a(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return u.type="throw",u.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return ut}));var r=n(6),o=n.n(r),i=n(7),u=n.n(i),a=(n(2),n(3)),c=n.n(a),s=n(0),l=n.n(s),f=n(4),d=n.n(f);n(5),n(1),n(10);function p(t,e,n){for(var r in t){if(t.hasOwnProperty(r))if(!1===e(t[r],r,t))return!1}return n&&n(),!0}function h(t,e,n){var r=n||function(t){return t};return e.reduce((function(e,n){return t.hasOwnProperty(n)&&(e[n]=r(t[n],n,t)),e}),{})}function v(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.forEach((function(e){p(e,(function(e,n){t[n]=e}))})),t}function m(t){var e=c()(t);return"object"!==e?e:Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function y(t){return"array"===m(t)}function w(t){var e=m(t);if("string"===e)return!0;if(["null","undefined","number","boolean"].indexOf(e)>-1)return!1;var n=!!t&&"length"in t&&t.length;return"function"!==e&&t!==window&&("array"===e||0===n||x(n)&&n>0&&n-1 in t)}function g(t){return"string"===m(t)}function x(t){return"number"===m(t)}function b(t){return"function"===m(t)}function E(t){return x(t)&&t!=t}function L(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t||this,o=r.length,i=n;i<o;i++){var u=r[i];if("function"==typeof e){if(e(u,i,r))return!0}else if(u===e)return!0;if(E(u)&&E(e))return!0}return!1}function S(t,e){if(!t.length)return t;for(var n=e||function(t,e){return t===e||E(t)&&E(e)},r=[t[0]],o=function(e){var o=t[e];if(r.some((function(t){return n(t,o)})))return"continue";r.push(o)},i=1;i<t.length;i++)o(i);return r}function _(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.length>=e||""===n)return r?t.substr(t.length-e):t;for(var o=e-t.length;n.length<o;)n+=n;return(n=n.substr(0,o))+t}var M=["零","一","二","三","四","五","六","七","八","九"],T=["十","百","千"],j=[""].concat(T,["万"],T,["亿"]),k=j.length,O=function t(e){var n=~~e,r="",o=0;if(e>=0&&e<10)return t.numbers[e];for(;n>=1&&o<k;){var i=t.units[o],u=t.numbers[n%10];u!==t.numbers[0]&&(r=i+r),1===n&&1===o||(r=u+r),n=~~(n/10),o++}return r.replace(/(零+$)|((零)\3+)/g,"$3")};O.units=d()(j),O.numbers=[].concat(M);var P=function t(e){if(new RegExp("([^".concat(t.units.join()+t.numbers.join(),"])")).test(e))throw new TypeError("发现不符合规则的字符(必须在units和numbers里存在的字符):"+RegExp.$1);return e.split(new RegExp("[".concat(t.units[4]).concat(t.units[8],"]"),"g")).map((function(e){for(var n=0,r=1,o=e.length-1;o>-1;o--){var i=e[o],u=t.numbers.indexOf(i);u>0&&(n+=u*r);var a=t.units.indexOf(i);r=a>0?Math.pow(10,a):r}return e[0]===t.units[1]&&(n+=10),n})).reverse().reduce((function(t,e,n){return t+Math.pow(1e4,n)*e}),0)};function I(t,e){if(e<0||e*t.length>I.MAX_STR_LENGTH)throw new RangeError("strRepeat Invalid repeatCount value");var n="";if(""===t)return"";for(;e-- >0;)n+=t;return n}P.units=d()(j),P.numbers=[].concat(M),I.MAX_STR_LENGTH=536870912;var A=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.seasonText,i=void 0===o?t.seasonText:o,u=r.weekText,a=void 0===u?t.weekText:u,c={"M+":function(){return e.getMonth()+1},"d+":function(){return e.getDate()},"h+":function(){return e.getHours()},"m+":function(){return e.getMinutes()},"s+":function(){return e.getSeconds()},q:function(){var t=Math.floor((e.getMonth()+3)/3)-1;return i[t]},"S+":function(){return e.getMilliseconds()},w:function(){return a[e.getDay()]}};for(var s in/(y+)/.test(n)&&(n=n.replace(RegExp.$1,_(String(e.getFullYear()),RegExp.$1.length,"0",!0))),c)if(new RegExp("("+s+")").test(n)){var l=RegExp.$1,f=String(c[s]());n=n.replace(l,_(f,l.length,"0"))}return n};A.weekText=["日","一","二","三","四","五","六"],A.seasonText=["春","夏","秋","冬"];var z=Function("return this")();var C=void 0===z.HTMLElement?function(t){return t&&"object"===c()(t)&&1===t.nodeType&&"string"==typeof t.nodeName}:function(t){return t instanceof HTMLElement};function N(t,e){return C(e)&&e.nodeName===t.toUpperCase()}function V(){return"ontouchstart"in window}function R(t){return"nodelist"===m(t)}var F,D,G;function H(t,e){var n=l()(t,2),r=n[0],o=n[1],i=l()(e,2),u=r-i[0],a=o-i[1];return Math.sqrt(u*u+a*a)}function q(t){var e=t.el,n=t.onDown,r=t.onMove,o=t.onUp,i=t.capture,u=void 0===i?{down:!1,up:!0,move:!1}:i,a=e;if(!C(e))if(g(e)){if(!(a=document.querySelector(e)))throw new Error("element not found!")}else a=window;var c,s={x:0,y:0},l={x:0,y:0};function f(t){var e={x:t.screenX,y:t.screenY};return e.x=~~e.x,e.y=~~e.y,e}function d(t){var e=(["touchcancel","touchend"].indexOf(t.type)>-1?t.changedTouches:t.touches)[0],n={x:e.clientX,y:e.clientY};return n.x=~~n.x,n.y=~~n.y,n}function p(t,e){if(!(t.touches&&t.touches.length>1)){l=(c="mouse"===e?f:d)(t),s=l;var r=void 0;return n&&b(n)&&(r=n.call(this,t,l)),r}w()}function h(t){var e=c(t),n=void 0;return r&&b(r)&&(n=r.call(this,t,e,s,l)),s=e,n}function v(t){var e=c(t),n=void 0;return s=e,o&&b(o)&&(n=o.call(this,t,e,l)),w(),n}function m(t){var e=p.call(this,t,"mouse");return window.addEventListener("mousemove",h,u.move),window.addEventListener("mouseup",v,u.up),e}function y(t){var e=p.call(this,t,"touch");return window.addEventListener("touchmove",h,u.move),window.addEventListener("touchend",v,u.up),window.addEventListener("touchcancel",v,u.up),e}function w(){window.removeEventListener("mousemove",h,u.move),window.removeEventListener("mouseup",v,u.up),window.removeEventListener("touchmove",h,u.move),window.removeEventListener("touchend",v,u.up),window.removeEventListener("touchcancel",v,u.up)}return a.addEventListener("mousedown",m,u.down),a.addEventListener("touchstart",y,u.down),function(){a.removeEventListener("mousedown",m,u.down),a.removeEventListener("touchstart",y,u.down),w()}}function Y(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.el,r=void 0===n?window:n,o=e.capture,i=void 0===o?{down:!1,up:!0,move:!1}:o,u={el:r,capture:i},a=function(t){u.onDown=t},c=function(t){u.onMove=t},s=function(t){u.onUp=t};return t({onDown:a,onMove:c,onUp:s}),q(u)}function $(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{down:!1,up:!0,move:!1},r=t;if(!C(t))if(g(t)){if(!(r=document.querySelector(t)))throw new Error("element not found!")}else r=window;var o=0;function i(t){var e=t[0],n=t[1];return H([e.pageX,e.pageY],[n.pageX,n.pageY])}function u(t){t.touches.length<2||e(+i(t.touches).toFixed(2),o)}function a(t){s()}function c(t){t.touches.length<2||(window.addEventListener("touchmove",u,n.move),window.addEventListener("touchend",a,n.up),window.addEventListener("touchcancel",a,n.up),o=+i(t.touches).toFixed(2))}function s(){window.removeEventListener("touchmove",u,n.move),window.removeEventListener("touchend",a,n.up),window.removeEventListener("touchcancel",a,n.up)}function l(){r.removeEventListener("touchstart",c,n.down),s()}return r.addEventListener("touchstart",c,n.down),l}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(F||(F={}));var U=null!==(G=null===(D=null==z?void 0:z.document)||void 0===D?void 0:D.createElement("div").style)&&void 0!==G?G:{},X=function(){var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t){if(void 0!==U[t[e]])return e}return!1}();function Z(){var t;return!!(null===(t=null==z?void 0:z.document)||void 0===t?void 0:t.documentElement.classList)}function W(t){if(!t)return[];var e=t;return g(t)&&(e=[t.trim()]),e.reduce((function(t,e){var n=e.trim().split(/ +/);return t.push.apply(t,d()(n)),t}),[])}Z();var B=Z()?function(t,e){var n=W(e),r=t.classList;return n.forEach((function(t){return r.add(t)})),t.className}:function(t,e){var n=W(e),r=t.className+" "+n.join(" ");return n=(n=S(n=r.split(" "))).filter((function(t){return Boolean(t)})),t.className=n.join(" "),t.className};var J=Z()?function(t,e){return W(e).forEach((function(e){t.classList.remove(e)})),t.className}:function(t,e){var n=W(e),r=S(t.className.split(/ +/).filter((function(t){return!L(n,t)})));return t.className=r.join(" ")};function K(t){return!1===X?null:"standard"===X?t:X+t.charAt(0).toUpperCase()+t.substr(1)}function Q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement(t),r=e.attrs,o=void 0===r?{}:r,i=e.props,u=void 0===i?{}:i,a=e.parent,s=e.children;if(p(u,(function(t,e){var r="object"===c()(t);"style"===e&&r?v(n.style,t):n[e]=t})),p(o,(function(t,e){var r="object"===c()(t);n.setAttribute(e,r?JSON.stringify(t):t)})),(y(s)||R(s))&&s.forEach((function(t){return n.appendChild(t)})),a)if(C(a))a.appendChild(n);else if(g(a)){var l=document.querySelector(a);if(!l)throw new TypeError("createHtmlElement param 'parent' => \"".concat(a,'" not founded'));l.appendChild(n)}return n}var tt=Q;var et="\n.img-zoom-wrapper {\n z-index: 10000;\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.7);\n cursor: zoom-out;\n}\n.img-zoom-wrapper.hide {\n display: none;\n}\n.img-zoom-wrapper .img-zoom-view {\n z-index: 1000000;\n position: fixed;\n left: 50%;\n top: 50%;\n display: block;\n width: auto;\n height: auto;\n cursor: move;\n -webkit-transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n -o-transform: translate(-50%, -50%);\n -ms-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n user-select: none;\n border: none;\n outline: none;\n}\n".replace(/[\n\r]/g,""),nt=K("transform"),rt={max:10,min:.1,step:.1,default:1},ot={triggerEl:".img-zoom",isClickViewImgClose:!1,dataset:"data-img-zoom"},it=function(){},ut=function(){function t(e){o()(this,t),this.needCancelEventList=[];var n=v({},ot,e||{});n.scale=v({},rt,n.scale||{}),this.options=n;var r=this.options.scale,i=r.min,u=r.max,a=r.default,c=r.step;if(u<i)throw new Error("scale.max不能小于scale.min");if(a<i)throw new Error("scale.default不能小于scale.min");if(a>u)throw new Error("scale.default不能大于scale.max");if(i<=0)throw new Error("scale.min不能小于等于0");c>u&&console.warn("scale.step已大于scale.max"),this.init()}return u()(t,[{key:"init",value:function(){this.initView(),this.addInitViewEventListener(),this.initTrigger()}},{key:"setImg",value:function(t){var e=this;this.scale=this.options.scale.default,this.zoomImg.src=t,J(this.wrapper,"hide");var n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=t;if(g(t)){if(!(e=document.querySelector(t)))throw new Error("el not found")}else t===window&&(e=document.body.scrollTop?document.body:document.documentElement);var n=h(getComputedStyle(e),["marginTop","overflow"]),r=e.scrollTop;return e.scrollTop=0,e.style.overflow="hidden",e.style.marginTop=-r+parseInt(n.marginTop)+"px",function(){v(e.style,n),e.scrollTop=r}}(window);this.noScrollCanceller=function(){e.noScrollCanceller=void 0,n()},this.resetViewScaleAndPosition()}},{key:"initTrigger",value:function(){var t=this,e=function(e){var n=e.target,r=n.getAttribute(t.options.dataset);!r&&N("IMG",n)&&(r=e.target.src),r&&t.setImg(r)},n=this.options.triggerEl,r=w(n)?n:[n],o=this.needCancelEventList;Array.prototype.forEach.call(r,(function(t){C(t)&&(t.addEventListener("click",e),o.push((function(){t.removeEventListener("click",e)}))),g(t)&&o.push(function(t,e,n,r){var o;function i(t){t=t||window.event,L(C(n)?[n]:document.querySelectorAll(n),t.target)&&r(t)}return null===(o=t?C(t)?t:document.querySelector(t):document.documentElement)?null:(o.addEventListener(e,i),function(){o.removeEventListener(e,i)})}(null,"click",t,e))}));var i=function(t,e){var n,r,o,i,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!0,c=function(){clearTimeout(i),i=void 0},s=function t(){i&&c(),n=this;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];return r=l,a&&u?(t.flush(),a=!1,i=setTimeout((function(){a=!0}),e),o):(i=setTimeout((function(){c(),t.flush(),a=!0}),e),o)};return s.cancel=c,s.flush=function(){return o=t.apply(n,r),n=r=void 0,o},s}((function(){it("resize"),t.resetViewScaleAndPosition(),t.saveViewPositionFromMatrix()}),100);window.addEventListener("resize",i),this.needCancelEventList.push((function(){window.removeEventListener("resize",i)}))}},{key:"resetViewScaleAndPosition",value:function(){this.zoomImg.style[nt]="translate(-50%, -50%) scale(".concat(this.scale,")")}},{key:"getViewPosition",value:function(){var t=window.innerHeight||document.documentElement.clientHeight,e=window.innerWidth||document.documentElement.clientWidth,n=this.zoomImg,r=n.offsetWidth,o=n.offsetHeight;it(t,e,r,o),this.left=(t-r)/2,this.top=(e-o)/2}},{key:"getZoomImgStyleMatrixVal",value:function(){var t=getComputedStyle(this.zoomImg)[nt];return(/matrix\(([\d\\.,\- ]+)\)/.test(t)?RegExp.$1:"0,0,0,0,0,0").split(/, ?/)}},{key:"saveViewPositionFromMatrix",value:function(){var t=this.getZoomImgStyleMatrixVal();this.left=Number(t[4])||0,this.top=Number(t[5])||0}},{key:"setViewScaleAndPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.scale,n=this.getZoomImgStyleMatrixVal();n[0]=n[3]=e,n[4]=this.left,n[5]=this.top,this.zoomImg.style[nt]="".concat(t&&V()?"translateZ(0) ":"","matrix(").concat(n.join(", "),")")}},{key:"initView",value:function(){var t=this;tt("style",{props:{innerHTML:et},parent:document.head});var e=tt("img",{props:{className:"img-zoom-view",draggable:!1,onclick:function(){},onload:function(){t.saveViewPositionFromMatrix()}},attrs:{ondragstart:"return false"}});this.wrapper=tt("div",{props:{className:"img-zoom-wrapper hide"},children:[e],parent:document.body}),this.zoomImg=e}},{key:"setScale",value:function(t){var e=this.options.scale;this.scale=Math.max(e.min,Math.min(t,e.max)),this.setViewScaleAndPosition()}},{key:"scaleIncrease",value:function(){var t=this.options.scale,e=this.scale+t.step;this.setScale(e)}},{key:"scaleDecrease",value:function(){var t=this.options.scale,e=this.scale-t.step;this.setScale(e)}},{key:"addInitViewEventListener",value:function(){var t=this,e=arguments,n=this.wrapper,r=this.zoomImg,o=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(n){if(!e||!V())return it("wrapper click"),t.noScrollCanceller&&t.noScrollCanceller(),B(t.wrapper,"hide"),n.stopPropagation(),n.preventDefault(),!1}};n.addEventListener("mouseup",o()),n.addEventListener("touchend",o(!0)),n.addEventListener("touchcancel",o(!0)),n.addEventListener("wheel",(function(e){return(e=e||window.event).deltaY>0?t.scaleDecrease():t.scaleIncrease(),e.stopPropagation(),e.preventDefault(),!1}));var i=Q("div",{props:{style:{position:"fixed",zIndex:"11111111111111111",top:"0",left:"0",background:"white",padding:"20px"}}});$(r,(function(e,n){t.setScale(t.scale/n*e),i.innerText="".concat(e," / ").concat(n," / ").concat(t.scale)})),Y((function(n){var r=n.onMove,o=n.onDown,i=n.onUp;o((function(t){return it(e),t.stopPropagation(),t.preventDefault(),!1})),r((function(e,n,r,o){var i=n.x,u=n.y,a=~~(i-r.x),c=~~(u-r.y);t.left+=a,t.top+=c,t.setViewScaleAndPosition(!0)})),i((function(e,n,r){if(t.setViewScaleAndPosition(),!t.options.isClickViewImgClose||n.x!==r.x&&n.y!==r.y)return e.stopPropagation(),e.preventDefault(),!1}))}),{el:r})}},{key:"destroy",value:function(){this.needCancelEventList.forEach((function(t){return t()})),this.wrapper.parentNode.removeChild(this.wrapper)}}]),t}()}]).default}));
{
"name": "@mxssfd/img-zoom",
"version": "1.2.6",
"version": "1.2.7",
"author": "dyh",

@@ -9,3 +9,3 @@ "description": "原生ts/js html图片缩放库",

"jsnext:main": "./lib-es/index.js",
"typings": "./types/index.d.ts",
"types": "./types/index.d.ts",
"sideEffects": false,

@@ -75,6 +75,6 @@ "files": [

"import": "./lib-es/index.js",
"require": "./lib-cjs/index.js"
},
"./": "./"
"require": "./lib-cjs/index.js",
"types": "./types/index.d.ts"
}
}
}

@@ -0,0 +0,0 @@ # 点击img图片 缩放显示大图插件

@@ -0,0 +0,0 @@ interface ScaleOption {

export declare const style: string;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc