function-call-legacy.ec02c576.js 7.2 KB

1
  1. !function(){function o(o,t){return function(o){if(Array.isArray(o))return o}(o)||function(o,e){var t=null==o?null:"undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(null==t)return;var n,a,i=[],r=!0,s=!1;try{for(t=t.call(o);!(r=(n=t.next()).done)&&(i.push(n.value),!e||i.length!==e);r=!0);}catch(c){s=!0,a=c}finally{try{r||null==t.return||t.return()}finally{if(s)throw a}}return i}(o,t)||function(o,t){if(!o)return;if("string"==typeof o)return e(o,t);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(o,t)}(o,t)||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.")}()}function e(o,e){(null==e||e>o.length)&&(e=o.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=o[t];return n}System.register(["./index-legacy.a9944503.js","./index-legacy.8bfb99fc.js","./index-legacy.aa24f77a.js"],(function(e){"use strict";var t,n,a,i,r,s,c,l,u,v,m,f,g,h,d,p,y,w,x,b,P,I,C,S,Z,X,Y,z,H,W,R,A,T,j,M,N,O,D,B;return{setters:[function(o){t=o.t,n=o.d,a=o.au,i=o.z,r=o.r,s=o.an,c=o.R,l=o.y,u=o.Z,v=o.a0,m=o.c,f=o.a4,g=o.at,h=o.L,d=o.b9,p=o.W,y=o.$,w=o.aH,x=o.aQ,b=o._,P=o.E,I=o.ak,C=o.P,S=o.v,Z=o.av,X=o.w,Y=o.O,z=o.u,H=o.al,W=o.ax,R=o.a5,A=o.aM,T=o.aa,j=o.N,M=o.ba,N=o.bb},function(o){O=o.a,D=o.S},function(o){B=o.I}],execute:function(){var $,L=function(o){return Math.sqrt(Math.pow(o[0].clientX-o[1].clientX,2)+Math.pow(o[0].clientY-o[1].clientY,2))},U=t("image-preview")[1],k=n({props:{src:String,show:Boolean,active:Number,minZoom:a(i),maxZoom:a(i),rootWidth:a(Number),rootHeight:a(Number)},emits:["scale","close","longPress"],setup:function(o,e){var t,n,a,i,p,y,w,x=e.emit,b=e.slots,P=r({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,imageRatio:0,displayWidth:0,displayHeight:0}),I=s(),C=c(),S=l((function(){var e=o.rootWidth,t=o.rootHeight/e;return P.imageRatio>t})),Z=l((function(){var o=P.scale,e=P.moveX,t=P.moveY,n=P.moving,a={transitionDuration:P.zooming||n?"0s":".3s"};if(1!==o){var i=e/o,r=t/o;a.transform="scale(".concat(o,", ").concat(o,") translate(").concat(i,"px, ").concat(r,"px)")}return a})),X=l((function(){if(P.imageRatio){var e=o.rootWidth,t=o.rootHeight,n=S.value?t/P.imageRatio:e;return Math.max(0,(P.scale*n-e)/2)}return 0})),Y=l((function(){if(P.imageRatio){var e=o.rootWidth,t=o.rootHeight,n=S.value?t:e*P.imageRatio;return Math.max(0,(P.scale*n-t)/2)}return 0})),z=function(e){(e=g(e,+o.minZoom,+o.maxZoom+1))!==P.scale&&(P.scale=e,x("scale",{scale:e,index:o.active}))},H=function(){z(1),P.moveX=0,P.moveY=0},W=function(o){var e=o.touches,r=I.offsetX;I.start(o),t=e.length,n=P.moveX,a=P.moveY,w=Date.now(),P.moving=1===t&&1!==P.scale,P.zooming=2===t&&!r.value,P.zooming&&(i=P.scale,p=L(o.touches))},R=function(){if(!(t>1)){var o,e=I.offsetX,n=I.offsetY,a=Date.now()-w;e.value<5&&n.value<5&&(a<250?y?(clearTimeout(y),y=null,o=P.scale>1?1:2,z(o),P.moveX=0,P.moveY=0):y=setTimeout((function(){x("close"),y=null}),250):a>d&&x("longPress"))}},A=function(e){var t=!1;(P.moving||P.zooming)&&(t=!0,P.moving&&n===P.moveX&&a===P.moveY&&(t=!1),e.touches.length||(P.zooming&&(P.moveX=g(P.moveX,-X.value,X.value),P.moveY=g(P.moveY,-Y.value,Y.value),P.zooming=!1),P.moving=!1,n=0,a=0,i=1,P.scale<1&&H(),P.scale>o.maxZoom&&(P.scale=+o.maxZoom))),f(e,t),R(),I.reset()},T=function(o){var e=o.target,t=e.naturalWidth,n=e.naturalHeight;P.imageRatio=n/t};return u((function(){return o.active}),H),u((function(){return o.show}),(function(o){o||H()})),v("touchmove",(function(o){var e=o.touches;if(I.move(o),(P.moving||P.zooming)&&f(o,!0),P.moving){var t=I.deltaX,r=I.deltaY,s=t.value+n,c=r.value+a;P.moveX=g(s,-X.value,X.value),P.moveY=g(c,-Y.value,Y.value)}if(P.zooming&&2===e.length){var l=L(e);z(i*l/p)}}),{target:l((function(){var o;return null==(o=C.value)?void 0:o.$el}))}),function(){var e={loading:function(){return m(h,{type:"spinner"},null)}};return m(O,{ref:C,class:U("swipe-item"),onTouchstartPassive:W,onTouchend:A,onTouchcancel:A},{default:function(){return[b.image?m("div",{class:U("image-wrap")},[b.image({src:o.src})]):m(B,{src:o.src,fit:"contain",class:U("image",{vertical:S.value}),style:Z.value,onLoad:T},e)]}})}}}),E=o(t("image-preview"),2),q=E[0],F=E[1],Q=["show","transition","overlayStyle","closeOnPopstate"],_={show:Boolean,loop:S,images:Z(),minZoom:X(1/3),maxZoom:X(3),overlay:S,closeable:Boolean,showIndex:S,className:Y,closeIcon:z("clear"),transition:String,beforeClose:Function,overlayClass:Y,overlayStyle:Object,swipeDuration:X(300),startPosition:X(0),showIndicators:Boolean,closeOnPopstate:S,closeIconPosition:z("top-right")},G=n({name:q,props:_,emits:["scale","close","closed","change","longPress","update:show"],setup:function(o,e){var t=e.emit,n=e.slots,a=c(),i=r({active:0,rootWidth:0,rootHeight:0}),s=function(){if(a.value){var o=H(a.value.$el);i.rootWidth=o.width,i.rootHeight=o.height,a.value.resize()}},l=function(o){return t("scale",o)},v=function(o){return t("update:show",o)},f=function(){A(o.beforeClose,{args:[i.active],done:function(){return v(!1)}})},g=function(o){o!==i.active&&(i.active=o,t("change",o))},h=function(){if(o.showIndex)return m("div",{class:F("index")},[n.index?n.index({index:i.active}):"".concat(i.active+1," / ").concat(o.images.length)])},d=function(){if(n.cover)return m("div",{class:F("cover")},[n.cover()])},S=function(){if(o.closeable)return m(R,{role:"button",name:o.closeIcon,class:[F("close-icon",o.closeIconPosition),W],onClick:f},null)},Z=function(){return t("closed")},X=function(o,e){var t;return null==(t=a.value)?void 0:t.swipeTo(o,e)};return p({swipeTo:X}),y(s),u([w,x],s),u((function(){return o.startPosition}),(function(o){return g(+o)})),u((function(){return o.show}),(function(e){var n=o.images,a=o.startPosition;e?(g(+a),b((function(){s(),X(+a,{immediate:!0})}))):t("close",{index:i.active,url:n[i.active]})})),function(){return m(C,P({class:[F(),o.className],overlayClass:[F("overlay"),o.overlayClass],onClosed:Z,"onUpdate:show":v},I(o,Q)),{default:function(){return[S(),m(D,{ref:a,lazyRender:!0,loop:o.loop,class:F("swipe"),duration:o.swipeDuration,initialSwipe:o.startPosition,showIndicators:o.showIndicators,indicatorColor:"white",onChange:g},{default:function(){return[o.images.map((function(e,a){return m(k,{src:e,show:o.show,active:i.active,maxZoom:o.maxZoom,minZoom:o.minZoom,rootWidth:i.rootWidth,rootHeight:i.rootHeight,onScale:l,onClose:f,onLongPress:function(){return t("longPress",{index:a})}},{image:n.image})}))]}}),h(),d()]}})}}}),J={loop:!0,images:[],maxZoom:3,minZoom:1/3,onScale:void 0,onClose:void 0,onChange:void 0,teleport:"body",className:"",showIndex:!0,closeable:!1,closeIcon:"clear",transition:void 0,beforeClose:void 0,overlayStyle:void 0,overlayClass:void 0,startPosition:0,swipeDuration:300,showIndicators:!1,closeOnPopstate:!0,closeIconPosition:"top-right"};function K(){var o=M({setup:function(){var o=N(),e=o.state,t=o.toggle,n=function(){e.images=[]};return function(){return m(G,P(e,{onClosed:n,"onUpdate:show":t}),null)}}});$=o.instance}e("s",(function(o){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(T)return $||K(),o=Array.isArray(o)?{images:o,startPosition:e}:o,$.open(j({},J,o)),$}))}}}))}();