1 |
- !function(){function e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,o){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var i,a,t=[],r=!0,c=!1;try{for(n=n.call(e);!(r=(i=n.next()).done)&&(t.push(i.value),!o||t.length!==o);r=!0);}catch(l){c=!0,a=l}finally{try{r||null==n.return||n.return()}finally{if(c)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return o(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(e,n)}(e,n)||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 o(e,o){(null==o||o>e.length)&&(o=e.length);for(var n=0,i=new Array(o);n<o;n++)i[n]=e[n];return i}var n=document.createElement("style");n.innerHTML=":root{--van-image-preview-index-text-color: var(--van-white);--van-image-preview-index-font-size: var(--van-font-size-md);--van-image-preview-index-line-height: var(--van-line-height-md);--van-image-preview-index-text-shadow: 0 .02667rem .02667rem var(--van-gray-8);--van-image-preview-overlay-background-color: rgba(0, 0, 0, .9);--van-image-preview-close-icon-size: .58667rem;--van-image-preview-close-icon-color: var(--van-gray-5);--van-image-preview-close-icon-margin: var(--van-padding-md);--van-image-preview-close-icon-z-index: 1}.van-image-preview{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;transform:none}.van-image-preview__swipe{height:100%}.van-image-preview__swipe-item{display:flex;align-items:center;justify-content:center;overflow:hidden}.van-image-preview__cover{position:absolute;top:0;left:0}.van-image-preview__image{width:100%;transition-property:transform}.van-image-preview__image--vertical{width:auto;height:100%}.van-image-preview__image img{-webkit-user-drag:none}.van-image-preview__image .van-image__error{top:30%;height:40%}.van-image-preview__image .van-image__error-icon{font-size:.96rem}.van-image-preview__image .van-image__loading{background-color:transparent}.van-image-preview__index{position:absolute;top:var(--van-padding-md);left:50%;color:var(--van-image-preview-index-text-color);font-size:var(--van-image-preview-index-font-size);line-height:var(--van-image-preview-index-line-height);text-shadow:var(--van-image-preview-index-text-shadow);transform:translate(-50%)}.van-image-preview__overlay{background:var(--van-image-preview-overlay-background-color)}.van-image-preview__close-icon{position:absolute;z-index:var(--van-image-preview-close-icon-z-index);color:var(--van-image-preview-close-icon-color);font-size:var(--van-image-preview-close-icon-size)}.van-image-preview__close-icon--top-left{top:var(--van-image-preview-close-icon-margin);left:var(--van-image-preview-close-icon-margin)}.van-image-preview__close-icon--top-right{top:var(--van-image-preview-close-icon-margin);right:var(--van-image-preview-close-icon-margin)}.van-image-preview__close-icon--bottom-left{bottom:var(--van-image-preview-close-icon-margin);left:var(--van-image-preview-close-icon-margin)}.van-image-preview__close-icon--bottom-right{right:var(--van-image-preview-close-icon-margin);bottom:var(--van-image-preview-close-icon-margin)}\n",document.head.appendChild(n),System.register(["./index-legacy.fba2875c.js","./index-legacy.af00a324.js","./index-legacy.d92f7da7.js"],(function(o){"use strict";var n,i,a,t,r,c,l,s,v,m,u,g,f,p,d,h,w,y,x,b,_,z,C,I,S,X,Z,Y,H,P,W,j,A,T,R,k,M,N;return{setters:[function(e){n=e.A,i=e.d,a=e.aw,t=e.E,r=e.Q,c=e.ah,l=e.V,s=e.a2,v=e.j,m=e.ap,u=e.ar,g=e.aS,f=e.G,p=e.aV,d=e.aa,h=e.H,w=e.$,y=e.S,x=e.aj,b=e.U,_=e.ak,z=e.al,C=e.W,I=e.a7,S=e.aA,X=e.aR,Z=e.X,Y=e.aX,H=e.M,P=e.aB,W=e.a3,j=e.I,A=e.N,T=e.bo,R=e.bp},function(e){k=e.a,M=e.S},function(e){N=e.I}],execute:function(){var D,O=function(e){return Math.sqrt(Math.pow(e[0].clientX-e[1].clientX,2)+Math.pow(e[0].clientY-e[1].clientY,2))},B=n("image-preview")[1],U=i({props:{src:String,show:Boolean,active:Number,minZoom:a(t),maxZoom:a(t),rootWidth:a(Number),rootHeight:a(Number)},emits:["scale","close"],setup:function(e,o){var n,i,a,t,f,p,d,h=o.emit,w=r({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,imageRatio:0,displayWidth:0,displayHeight:0}),y=c(),x=l((function(){var o=e.rootWidth,n=e.rootHeight/o;return w.imageRatio>n})),b=l((function(){var e=w.scale,o=w.moveX,n=w.moveY,i=w.moving,a={transitionDuration:w.zooming||i?"0s":".3s"};if(1!==e){var t=o/e,r=n/e;a.transform="scale(".concat(e,", ").concat(e,") translate(").concat(t,"px, ").concat(r,"px)")}return a})),_=l((function(){if(w.imageRatio){var o=e.rootWidth,n=e.rootHeight,i=x.value?n/w.imageRatio:o;return Math.max(0,(w.scale*i-o)/2)}return 0})),z=l((function(){if(w.imageRatio){var o=e.rootWidth,n=e.rootHeight,i=x.value?n:o*w.imageRatio;return Math.max(0,(w.scale*i-n)/2)}return 0})),C=function(o){(o=u(o,+e.minZoom,+e.maxZoom+1))!==w.scale&&(w.scale=o,h("scale",{scale:o,index:e.active}))},I=function(){C(1),w.moveX=0,w.moveY=0},S=function(e){var o=e.touches,r=y.offsetX;y.start(e),n=o.length,i=w.moveX,a=w.moveY,d=Date.now(),w.moving=1===n&&1!==w.scale,w.zooming=2===n&&!r.value,w.zooming&&(t=w.scale,f=O(e.touches))},X=function(e){var o=e.touches;if(y.move(e),(w.moving||w.zooming)&&m(e,!0),w.moving){var n=y.deltaX,r=y.deltaY,c=n.value+i,l=r.value+a;w.moveX=u(c,-_.value,_.value),w.moveY=u(l,-z.value,z.value)}if(w.zooming&&2===o.length){var s=O(o);C(t*s/f)}},Z=function(){if(!(n>1)){var e,o=y.offsetX,i=y.offsetY,a=Date.now()-d;o.value<5&&i.value<5&&a<250&&(p?(clearTimeout(p),p=null,e=w.scale>1?1:2,C(e),w.moveX=0,w.moveY=0):p=setTimeout((function(){h("close"),p=null}),250))}},Y=function(o){var n=!1;(w.moving||w.zooming)&&(n=!0,w.moving&&i===w.moveX&&a===w.moveY&&(n=!1),o.touches.length||(w.zooming&&(w.moveX=u(w.moveX,-_.value,_.value),w.moveY=u(w.moveY,-z.value,z.value),w.zooming=!1),w.moving=!1,i=0,a=0,t=1,w.scale<1&&I(),w.scale>e.maxZoom&&(w.scale=+e.maxZoom))),m(o,n),Z(),y.reset()},H=function(e){var o=e.target,n=o.naturalWidth,i=o.naturalHeight;w.imageRatio=i/n};return s((function(){return e.active}),I),s((function(){return e.show}),(function(e){e||I()})),function(){var o={loading:function(){return v(g,{type:"spinner"},null)}};return v(k,{class:B("swipe-item"),onTouchstart:S,onTouchmove:X,onTouchend:Y,onTouchcancel:Y},{default:function(){return[v(N,{src:e.src,fit:"contain",class:B("image",{vertical:x.value}),style:b.value,onLoad:H},o)]}})}}}),E=e(n("image-preview"),2),$=E[0],L=E[1],V=["show","transition","overlayStyle","closeOnPopstate"],q={show:Boolean,loop:f,images:p(),minZoom:d(1/3),maxZoom:d(3),overlay:f,closeable:Boolean,showIndex:f,className:h,closeIcon:w("clear"),transition:String,beforeClose:Function,overlayClass:h,overlayStyle:Object,swipeDuration:d(300),startPosition:d(0),showIndicators:Boolean,closeOnPopstate:f,closeIconPosition:w("top-right")},F=i({name:$,props:q,emits:["scale","close","closed","change","update:show"],setup:function(e,o){var n=o.emit,i=o.slots,a=y(),t=r({active:0,rootWidth:0,rootHeight:0}),c=function(){if(a.value){var e=Z(a.value.$el);t.rootWidth=e.width,t.rootHeight=e.height,a.value.resize()}},l=function(e){return n("scale",e)},m=function(e){return n("update:show",e)},u=function(){P(e.beforeClose,{args:[t.active],done:function(){return m(!1)}})},g=function(e){e!==t.active&&(t.active=e,n("change",e))},f=function(){if(e.showIndex)return v("div",{class:L("index")},[i.index?i.index({index:t.active}):"".concat(t.active+1," / ").concat(e.images.length)])},p=function(){if(i.cover)return v("div",{class:L("cover")},[i.cover()])},d=function(){if(e.closeable)return v(H,{role:"button",name:e.closeIcon,class:[L("close-icon",e.closeIconPosition),Y],onClick:u},null)},h=function(){return n("closed")},w=function(e,o){var n;return null==(n=a.value)?void 0:n.swipeTo(e,o)};return x({swipeTo:w}),b(c),s([_,z],c),s((function(){return e.startPosition}),(function(e){return g(+e)})),s((function(){return e.show}),(function(o){var i=e.images,a=e.startPosition;o?(g(+a),C((function(){c(),w(+a,{immediate:!0})}))):n("close",{index:t.active,url:i[t.active]})})),function(){return v(X,I({class:[L(),e.className],overlayClass:[L("overlay"),e.overlayClass],onClosed:h,"onUpdate:show":m},S(e,V)),{default:function(){return[d(),v(M,{ref:a,lazyRender:!0,loop:e.loop,class:L("swipe"),duration:e.swipeDuration,initialSwipe:e.startPosition,showIndicators:e.showIndicators,indicatorColor:"white",onChange:g},{default:function(){return[e.images.map((function(o){return v(U,{src:o,show:e.show,active:t.active,maxZoom:e.maxZoom,minZoom:e.minZoom,rootWidth:t.rootWidth,rootHeight:t.rootHeight,onScale:l,onClose:u},null)}))]}}),f(),p()]}})}}}),G={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 e=T({setup:function(){var e=R(),o=e.state,n=e.toggle,i=function(){o.images=[]};return function(){return v(F,I(o,{onClosed:i,"onUpdate:show":n}),null)}}});D=e.instance}var J=o("I",(function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(W)return D||Q(),e=Array.isArray(e)?{images:e,startPosition:o}:e,D.open(j({},G,e)),D}));J.Component=A(F),J.install=function(e){e.use(J.Component)}}}}))}();
|