function-call-legacy.48cffee3.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,i,a=[],r=!0,s=!1;try{for(t=t.call(o);!(r=(n=t.next()).done)&&(a.push(n.value),!e||a.length!==e);r=!0);}catch(c){s=!0,i=c}finally{try{r||null==t.return||t.return()}finally{if(s)throw i}}return a}(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.e2eac9c9.js","./index-legacy.6b718bdc.js","./index-legacy.481310b2.js"],(function(e){"use strict";var t,n,i,a,r,s,c,l,u,v,m,f,g,d,h,p,y,w,b,x,P,I,C,S,Z,X,z,Y,W,H,R,A,O,T,j,N,D,M,B;return{setters:[function(o){t=o.t,n=o.d,i=o.ay,a=o.z,r=o.r,s=o.am,c=o.R,l=o.y,u=o.Z,v=o.a0,m=o.c,f=o.a4,g=o.ax,d=o.L,h=o.ba,p=o.W,y=o.$,w=o.aJ,b=o.aS,x=o._,P=o.E,I=o.ar,C=o.P,S=o.v,Z=o.ao,X=o.w,z=o.O,Y=o.u,W=o.ak,H=o.az,R=o.a5,A=o.aO,O=o.aa,T=o.N,j=o.bb,N=o.bc},function(o){D=o.a,M=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:i(a),maxZoom:i(a),rootWidth:i(Number),rootHeight:i(Number)},emits:["scale","close","longPress"],setup:function(o,e){var t,n,i,a,p,y,w,b=e.emit,x=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,i={transitionDuration:P.zooming||n?"0s":".3s"};if(1!==o){var a=e/o,r=t/o;i.transform="scale(".concat(o,", ").concat(o,") translate(").concat(a,"px, ").concat(r,"px)")}return i})),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})),z=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})),Y=function(e){(e=g(e,+o.minZoom,+o.maxZoom+1))!==P.scale&&(P.scale=e,b("scale",{scale:e,index:o.active}))},W=function(){Y(1),P.moveX=0,P.moveY=0},H=function(o){var e=o.touches,r=I.offsetX;I.start(o),t=e.length,n=P.moveX,i=P.moveY,w=Date.now(),P.moving=1===t&&1!==P.scale,P.zooming=2===t&&!r.value,P.zooming&&(a=P.scale,p=L(o.touches))},R=function(){if(!(t>1)){var o,e=I.offsetX,n=I.offsetY,i=Date.now()-w;e.value<5&&n.value<5&&(i<250?y?(clearTimeout(y),y=null,o=P.scale>1?1:2,Y(o),P.moveX=0,P.moveY=0):y=setTimeout((function(){b("close"),y=null}),250):i>h&&b("longPress"))}},A=function(e){var t=!1;(P.moving||P.zooming)&&(t=!0,P.moving&&n===P.moveX&&i===P.moveY&&(t=!1),e.touches.length||(P.zooming&&(P.moveX=g(P.moveX,-X.value,X.value),P.moveY=g(P.moveY,-z.value,z.value),P.zooming=!1),P.moving=!1,n=0,i=0,a=1,P.scale<1&&W(),P.scale>o.maxZoom&&(P.scale=+o.maxZoom))),f(e,t),R(),I.reset()},O=function(o){var e=o.target,t=e.naturalWidth,n=e.naturalHeight;P.imageRatio=n/t};return u((function(){return o.active}),W),u((function(){return o.show}),(function(o){o||W()})),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+i;P.moveX=g(s,-X.value,X.value),P.moveY=g(c,-z.value,z.value)}if(P.zooming&&2===e.length){var l=L(e);Y(a*l/p)}}),{target:l((function(){var o;return null==(o=C.value)?void 0:o.$el}))}),function(){var e={loading:function(){return m(d,{type:"spinner"},null)}};return m(D,{ref:C,class:U("swipe-item"),onTouchstartPassive:H,onTouchend:A,onTouchcancel:A},{default:function(){return[x.image?m("div",{class:U("image-wrap")},[x.image({src:o.src})]):m(B,{src:o.src,fit:"contain",class:U("image",{vertical:S.value}),style:Z.value,onLoad:O},e)]}})}}}),E=o(t("image-preview"),2),q=E[0],F=E[1],J=["show","transition","overlayStyle","closeOnPopstate"],_={show:Boolean,loop:S,images:Z(),minZoom:X(1/3),maxZoom:X(3),overlay:S,closeable:Boolean,showIndex:S,className:z,closeIcon:Y("clear"),transition:String,beforeClose:Function,overlayClass:z,overlayStyle:Object,swipeDuration:X(300),startPosition:X(0),showIndicators:Boolean,closeOnPopstate:S,closeIconPosition:Y("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,i=c(),a=r({active:0,rootWidth:0,rootHeight:0}),s=function(){if(i.value){var o=W(i.value.$el);a.rootWidth=o.width,a.rootHeight=o.height,i.value.resize()}},l=function(o){return t("scale",o)},v=function(o){return t("update:show",o)},f=function(){A(o.beforeClose,{args:[a.active],done:function(){return v(!1)}})},g=function(o){o!==a.active&&(a.active=o,t("change",o))},d=function(){if(o.showIndex)return m("div",{class:F("index")},[n.index?n.index({index:a.active}):"".concat(a.active+1," / ").concat(o.images.length)])},h=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),H],onClick:f},null)},Z=function(){return t("closed")},X=function(o,e){var t;return null==(t=i.value)?void 0:t.swipeTo(o,e)};return p({swipeTo:X}),y(s),u([w,b],s),u((function(){return o.startPosition}),(function(o){return g(+o)})),u((function(){return o.show}),(function(e){var n=o.images,i=o.startPosition;e?(g(+i),x((function(){s(),X(+i,{immediate:!0})}))):t("close",{index:a.active,url:n[a.active]})})),function(){return m(C,P({class:[F(),o.className],overlayClass:[F("overlay"),o.overlayClass],onClosed:Z,"onUpdate:show":v},I(o,J)),{default:function(){return[S(),m(M,{ref:i,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,i){return m(k,{src:e,show:o.show,active:a.active,maxZoom:o.maxZoom,minZoom:o.minZoom,rootWidth:a.rootWidth,rootHeight:a.rootHeight,onScale:l,onClose:f,onLongPress:function(){return t("longPress",{index:i})}},{image:n.image})}))]}}),d(),h()]}})}}}),K={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 Q(){var o=j({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(O)return $||Q(),o=Array.isArray(o)?{images:o,startPosition:e}:o,$.open(T({},K,o)),$}))}}}))}();