import{d as Se,r as qe,w as Tt,p as Ot,o as Ue,f as Be,a as ft,b as At,e as Ze,h as $e,y as Ke,z as Ge,u as Qe,n as Je,F as ti,_ as ei}from"./index-be50c070.js";/*! * Viewer.js v1.11.6 * https://fengyuanchen.github.io/viewerjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2023-09-17T03:16:38.052Z */function Yt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,n)}return i}function kt(e){for(var t=1;t
',yt=typeof window<"u"&&typeof window.document<"u",P=yt?window:{},K=yt&&P.document.documentElement?"ontouchstart"in P.document.documentElement:!1,zt=yt?"PointerEvent"in P:!1,v="viewer",dt="move",_e="switch",it="zoom",lt="".concat(v,"-active"),si="".concat(v,"-close"),vt="".concat(v,"-fade"),It="".concat(v,"-fixed"),li="".concat(v,"-fullscreen"),Ht="".concat(v,"-fullscreen-exit"),W="".concat(v,"-hide"),ui="".concat(v,"-hide-md-down"),ci="".concat(v,"-hide-sm-down"),hi="".concat(v,"-hide-xs-down"),k="".concat(v,"-in"),nt="".concat(v,"-invisible"),G="".concat(v,"-loading"),fi="".concat(v,"-move"),qt="".concat(v,"-open"),q="".concat(v,"-show"),x="".concat(v,"-transition"),Q="click",Nt="dblclick",Ut="dragstart",Bt="focusin",Zt="keydown",z="load",X="error",di=K?"touchend touchcancel":"mouseup",vi=K?"touchmove":"mousemove",mi=K?"touchstart":"mousedown",$t=zt?"pointerdown":mi,Kt=zt?"pointermove":vi,Gt=zt?"pointerup pointercancel":di,Qt="resize",j="transitionend",Jt="wheel",te="ready",ee="show",ie="shown",ne="hide",re="hidden",ae="view",at="viewed",oe="move",se="moved",le="rotate",ue="rotated",ce="scale",he="scaled",fe="zoom",de="zoomed",ve="play",me="stop",gt="".concat(v,"Action"),jt=/\s\s*/,ut=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ot(e){return typeof e=="string"}var gi=Number.isNaN||P.isNaN;function O(e){return typeof e=="number"&&!gi(e)}function B(e){return typeof e>"u"}function J(e){return Dt(e)==="object"&&e!==null}var pi=Object.prototype.hasOwnProperty;function Z(e){if(!J(e))return!1;try{var t=e.constructor,i=t.prototype;return t&&i&&pi.call(i,"isPrototypeOf")}catch{return!1}}function p(e){return typeof e=="function"}function y(e,t){if(e&&p(t))if(Array.isArray(e)||O(e.length)){var i=e.length,n;for(n=0;n1?i-1:0),r=1;r0&&n.forEach(function(a){J(a)&&Object.keys(a).forEach(function(o){t[o]=a[o]})}),t},bi=/^(?:width|height|left|top|marginLeft|marginTop)$/;function L(e,t){var i=e.style;y(t,function(n,r){bi.test(r)&&O(n)&&(n+="px"),i[r]=n})}function yi(e){return ot(e)?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):e}function U(e,t){return!e||!t?!1:e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function f(e,t){if(!(!e||!t)){if(O(e.length)){y(e,function(n){f(n,t)});return}if(e.classList){e.classList.add(t);return}var i=e.className.trim();i?i.indexOf(t)<0&&(e.className="".concat(i," ").concat(t)):e.className=t}}function g(e,t){if(!(!e||!t)){if(O(e.length)){y(e,function(i){g(i,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function st(e,t,i){if(t){if(O(e.length)){y(e,function(n){st(n,t,i)});return}i?f(e,t):g(e,t)}}var wi=/([a-z\d])([A-Z])/g;function Lt(e){return e.replace(wi,"$1-$2").toLowerCase()}function $(e,t){return J(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(Lt(t)))}function Ct(e,t,i){J(i)?e[t]=i:e.dataset?e.dataset[t]=i:e.setAttribute("data-".concat(Lt(t)),i)}var Ae=function(){var e=!1;if(yt){var t=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(a){t=a}});P.addEventListener("test",i,n),P.removeEventListener("test",i,n)}return e}();function b(e,t,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=i;t.trim().split(jt).forEach(function(a){if(!Ae){var o=e.listeners;o&&o[a]&&o[a][i]&&(r=o[a][i],delete o[a][i],Object.keys(o[a]).length===0&&delete o[a],Object.keys(o).length===0&&delete e.listeners)}e.removeEventListener(a,r,n)})}function d(e,t,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=i;t.trim().split(jt).forEach(function(a){if(n.once&&!Ae){var o=e.listeners,s=o===void 0?{}:o;r=function(){delete s[a][i],e.removeEventListener(a,r,n);for(var l=arguments.length,u=new Array(l),h=0;hs?D=s/_:T=c*_,S=O(S)?S:.9,T=Math.min(T*S,h),D=Math.min(D*S,m);var I=(s-T)/2,N=(c-D)/2,E={left:I,top:N,x:I,y:N,width:T,height:D,oldRatio:1,ratio:T/h,aspectRatio:_,naturalWidth:h,naturalHeight:m},R=C({},E);n.rotatable&&(E.rotate=l.rotate||0,R.rotate=0),n.scalable&&(E.scaleX=l.scaleX||1,E.scaleY=l.scaleY||1,R.scaleX=1,R.scaleY=1),i.imageData=E,i.initialImageData=R,t&&t()})},renderImage:function(t){var i=this,n=this.image,r=this.imageData;if(L(n,C({width:r.width,height:r.height,marginLeft:r.x,marginTop:r.y},mt(r))),t)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&U(n,x)){var a=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){b(n,j,a)}},d(n,j,a,{once:!0})}else t()},resetImage:function(){var t=this.image;t&&(this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null,this.title.innerHTML="")}},_i={bind:function(){var t=this.options,i=this.viewer,n=this.canvas,r=this.element.ownerDocument;d(i,Q,this.onClick=this.click.bind(this)),d(i,Ut,this.onDragStart=this.dragstart.bind(this)),d(n,$t,this.onPointerDown=this.pointerdown.bind(this)),d(r,Kt,this.onPointerMove=this.pointermove.bind(this)),d(r,Gt,this.onPointerUp=this.pointerup.bind(this)),d(r,Zt,this.onKeyDown=this.keydown.bind(this)),d(window,Qt,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&d(i,Jt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&d(n,Nt,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,i=this.viewer,n=this.canvas,r=this.element.ownerDocument;b(i,Q,this.onClick),b(i,Ut,this.onDragStart),b(n,$t,this.onPointerDown),b(r,Kt,this.onPointerMove),b(r,Gt,this.onPointerUp),b(r,Zt,this.onKeyDown),b(window,Qt,this.onResize),t.zoomable&&t.zoomOnWheel&&b(i,Jt,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&b(n,Nt,this.onDblclick)}},Ai={click:function(t){var i=this.options,n=this.imageData,r=t.target,a=$(r,gt);switch(!a&&r.localName==="img"&&r.parentElement.localName==="li"&&(r=r.parentElement,a=$(r,gt)),K&&t.isTrusted&&r===this.canvas&&clearTimeout(this.clickCanvasTimeout),a){case"mix":this.played?this.stop():i.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view($(r,"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()}},dblclick:function(t){t.preventDefault(),this.viewed&&t.target===this.image&&(K&&t.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(t.isTrusted?t:t.detail&&t.detail.originalEvent))},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,n=this.options,r=this.image,a=this.index,o=this.viewerData;g(r,nt),n.loading&&g(this.canvas,G),r.style.cssText="height:0;"+"margin-left:".concat(o.width/2,"px;")+"margin-top:".concat(o.height/2,"px;")+"max-width:none!important;position:relative;width:0;",this.initImage(function(){st(r,fi,n.movable),st(r,x,n.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,p(n.viewed)&&d(i,at,n.viewed,{once:!0}),A(i,at,{originalImage:t.images[a],index:a,image:r},{cancelable:!1})})})},loadImage:function(t){var i=t.target,n=i.parentNode,r=n.offsetWidth||30,a=n.offsetHeight||50,o=!!$(i,"filled");De(i,this.options,function(s,c){var l=s/c,u=r,h=a;a*l>r?o?u=a*l:h=r/l:o?h=r/l:u=a*l,L(i,C({width:u,height:h},mt({translateX:(r-u)/2,translateY:(a-h)/2})))})},keydown:function(t){var i=this.options;if(i.keyboard){var n=t.keyCode||t.which||t.charCode;switch(n){case 13:this.viewer.contains(t.target)&&this.click(t);break}if(this.fulled)switch(n){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle());break}}},dragstart:function(t){t.target.localName==="img"&&t.preventDefault()},pointerdown:function(t){var i=this.options,n=this.pointers,r=t.buttons,a=t.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(O(r)&&r!==1||O(a)&&a!==0||t.ctrlKey))){t.preventDefault(),t.changedTouches?y(t.changedTouches,function(s){n[s.identifier]=ht(s)}):n[t.pointerId||0]=ht(t);var o=i.movable?dt:!1;i.zoomOnTouch&&i.zoomable&&Object.keys(n).length>1?o=it:i.slideOnTouch&&(t.pointerType==="touch"||t.type==="touchstart")&&this.isSwitchable()&&(o=_e),i.transition&&(o===dt||o===it)&&g(this.image,x),this.action=o}},pointermove:function(t){var i=this.pointers,n=this.action;!this.viewed||!n||(t.preventDefault(),t.changedTouches?y(t.changedTouches,function(r){C(i[r.identifier]||{},ht(r,!0))}):C(i[t.pointerId||0]||{},ht(t,!0)),this.change(t))},pointerup:function(t){var i=this,n=this.options,r=this.action,a=this.pointers,o;t.changedTouches?y(t.changedTouches,function(s){o=a[s.identifier],delete a[s.identifier]}):(o=a[t.pointerId||0],delete a[t.pointerId||0]),r&&(t.preventDefault(),n.transition&&(r===dt||r===it)&&f(this.image,x),this.action=!1,K&&r!==it&&o&&Date.now()-o.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),n.toggleOnDblclick&&this.viewed&&t.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){A(i.image,Nt,{originalEvent:t})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){i.imageClicked=!1},500)):(this.imageClicked=!1,n.backdrop&&n.backdrop!=="static"&&t.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){A(i.canvas,Q,{originalEvent:t})},50)))))},resize:function(){var t=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}y(this.player.getElementsByTagName("img"),function(i){d(i,z,t.loadImage.bind(t),{once:!0}),A(i,z)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var n=Number(this.options.zoomRatio)||.1,r=1;t.deltaY?r=t.deltaY>0?1:-1:t.wheelDelta?r=-t.wheelDelta/120:t.detail&&(r=t.detail>0?1:-1),this.zoom(-r*n,!0,null,t)}}},Di={show:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.element,n=this.options;if(n.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(p(n.show)&&d(i,ee,n.show,{once:!0}),A(i,ee)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var r=this.viewer;if(g(r,W),r.setAttribute("role","dialog"),r.setAttribute("aria-labelledby",this.title.id),r.setAttribute("aria-modal",!0),r.removeAttribute("aria-hidden"),n.transition&&!t){var a=this.shown.bind(this);this.transitioning={abort:function(){b(r,j,a),g(r,k)}},f(r,x),r.initialOffsetWidth=r.offsetWidth,d(r,j,a,{once:!0}),f(r,k)}else f(r,k),this.shown();return this},hide:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.element,r=this.options;if(r.inline||this.hiding||!(this.isShown||this.showing))return this;if(p(r.hide)&&d(n,ne,r.hide,{once:!0}),A(n,ne)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var a=this.viewer,o=this.image,s=function(){g(a,k),t.hidden()};if(r.transition&&!i){var c=function u(h){h&&h.target===a&&(b(a,j,u),t.hidden())},l=function(){U(a,x)?(d(a,j,c),g(a,k)):s()};this.transitioning={abort:function(){t.viewed&&U(o,x)?b(o,j,l):U(a,x)&&b(a,j,c)}},this.viewed&&U(o,x)?(d(o,j,l,{once:!0}),this.zoomTo(0,!1,null,null,!0)):l()}else s();return this},view:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(i=Number(i)||0,this.hiding||this.played||i<0||i>=this.length||this.viewed&&i===this.index)return this;if(!this.isShown)return this.index=i,this.show();this.viewing&&this.viewing.abort();var n=this.element,r=this.options,a=this.title,o=this.canvas,s=this.items[i],c=s.querySelector("img"),l=$(c,"originalUrl"),u=c.getAttribute("alt"),h=document.createElement("img");if(y(r.inheritedAttributes,function(D){var I=c.getAttribute(D);I!==null&&h.setAttribute(D,I)}),h.src=l,h.alt=u,p(r.view)&&d(n,ae,r.view,{once:!0}),A(n,ae,{originalImage:this.images[i],index:i,image:h})===!1||!this.isShown||this.hiding||this.played)return this;var m=this.items[this.index];m&&(g(m,lt),m.removeAttribute("aria-selected")),f(s,lt),s.setAttribute("aria-selected",!0),r.focus&&s.focus(),this.image=h,this.viewed=!1,this.index=i,this.imageData={},f(h,nt),r.loading&&f(o,G),o.innerHTML="",o.appendChild(h),this.renderList(),a.innerHTML="";var _=function(){var I=t.imageData,N=Array.isArray(r.title)?r.title[1]:r.title;a.innerHTML=yi(p(N)?N.call(t,h,I):"".concat(u," (").concat(I.naturalWidth," × ").concat(I.naturalHeight,")"))},S,T;return d(n,at,_,{once:!0}),this.viewing={abort:function(){b(n,at,_),h.complete?t.imageRendering?t.imageRendering.abort():t.imageInitializing&&t.imageInitializing.abort():(h.src="",b(h,z,S),t.timeout&&clearTimeout(t.timeout))}},h.complete?this.load():(d(h,z,S=function(){b(h,X,T),t.load()},{once:!0}),d(h,X,T=function(){b(h,z,S),t.timeout&&(clearTimeout(t.timeout),t.timeout=!1),g(h,nt),r.loading&&g(t.canvas,G)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){g(h,nt),t.timeout=!1},1e3)),this},prev:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.length-1,n=this.index+1;return n>i&&(n=t?0:i),this.view(n),this},move:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=this.imageData;return this.moveTo(B(t)?t:n.x+Number(t),B(i)?i:n.y+Number(i)),this},moveTo:function(t){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=this.element,o=this.options,s=this.imageData;if(t=Number(t),n=Number(n),this.viewed&&!this.played&&o.movable){var c=s.x,l=s.y,u=!1;if(O(t)?u=!0:t=c,O(n)?u=!0:n=l,u){if(p(o.move)&&d(a,oe,o.move,{once:!0}),A(a,oe,{x:t,y:n,oldX:c,oldY:l,originalEvent:r})===!1)return this;s.x=t,s.y=n,s.left=t,s.top=n,this.moving=!0,this.renderImage(function(){i.moving=!1,p(o.moved)&&d(a,se,o.moved,{once:!0}),A(a,se,{x:t,y:n,oldX:c,oldY:l,originalEvent:r},{cancelable:!1})})}}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this,n=this.element,r=this.options,a=this.imageData;if(t=Number(t),O(t)&&this.viewed&&!this.played&&r.rotatable){var o=a.rotate;if(p(r.rotate)&&d(n,le,r.rotate,{once:!0}),A(n,le,{degree:t,oldDegree:o})===!1)return this;a.rotate=t,this.rotating=!0,this.renderImage(function(){i.rotating=!1,p(r.rotated)&&d(n,ue,r.rotated,{once:!0}),A(n,ue,{degree:t,oldDegree:o},{cancelable:!1})})}return this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,r=this.element,a=this.options,o=this.imageData;if(t=Number(t),n=Number(n),this.viewed&&!this.played&&a.scalable){var s=o.scaleX,c=o.scaleY,l=!1;if(O(t)?l=!0:t=s,O(n)?l=!0:n=c,l){if(p(a.scale)&&d(r,ce,a.scale,{once:!0}),A(r,ce,{scaleX:t,scaleY:n,oldScaleX:s,oldScaleY:c})===!1)return this;o.scaleX=t,o.scaleY=n,this.scaling=!0,this.renderImage(function(){i.scaling=!1,p(a.scaled)&&d(r,he,a.scaled,{once:!0}),A(r,he,{scaleX:t,scaleY:n,oldScaleX:s,oldScaleY:c},{cancelable:!1})})}}return this},zoom:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=this.imageData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(a.width*t/a.naturalWidth,i,n,r),this},zoomTo:function(t){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=this.element,c=this.options,l=this.pointers,u=this.imageData,h=u.x,m=u.y,_=u.width,S=u.height,T=u.naturalWidth,D=u.naturalHeight;if(t=Math.max(0,t),O(t)&&this.viewed&&!this.played&&(o||c.zoomable)){if(!o){var I=Math.max(.01,c.minZoomRatio),N=Math.min(100,c.maxZoomRatio);t=Math.min(Math.max(t,I),N)}if(a)switch(a.type){case"wheel":c.zoomRatio>=.055&&t>.95&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":t>.99&&t<1.01&&(t=1);break}var E=T*t,R=D*t,M=E-_,V=R-S,Y=u.ratio;if(p(c.zoom)&&d(s,fe,c.zoom,{once:!0}),A(s,fe,{ratio:t,oldRatio:Y,originalEvent:a})===!1)return this;if(this.zooming=!0,a){var tt=Ei(this.viewer),H=l&&Object.keys(l).length>0?Si(l):{pageX:a.pageX,pageY:a.pageY};u.x-=M*((H.pageX-tt.left-h)/_),u.y-=V*((H.pageY-tt.top-m)/S)}else Z(r)&&O(r.x)&&O(r.y)?(u.x-=M*((r.x-h)/_),u.y-=V*((r.y-m)/S)):(u.x-=M/2,u.y-=V/2);u.left=u.x,u.top=u.y,u.width=E,u.height=R,u.oldRatio=Y,u.ratio=t,this.renderImage(function(){i.zooming=!1,p(c.zoomed)&&d(s,de,c.zoomed,{once:!0}),A(s,de,{ratio:t,oldRatio:Y,originalEvent:a},{cancelable:!1})}),n&&this.tooltip()}return this},play:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var n=this.element,r=this.options;if(p(r.play)&&d(n,ve,r.play,{once:!0}),A(n,ve)===!1)return this;var a=this.player,o=this.loadImage.bind(this),s=[],c=0,l=0;if(this.played=!0,this.onLoadWhenPlay=o,i&&this.requestFullscreen(i),f(a,q),y(this.items,function(m,_){var S=m.querySelector("img"),T=document.createElement("img");T.src=$(S,"originalUrl"),T.alt=S.getAttribute("alt"),T.referrerPolicy=S.referrerPolicy,c+=1,f(T,vt),st(T,x,r.transition),U(m,lt)&&(f(T,k),l=_),s.push(T),d(T,z,o,{once:!0}),a.appendChild(T)}),O(r.interval)&&r.interval>0){var u=function m(){clearTimeout(t.playing.timeout),g(s[l],k),l-=1,l=l>=0?l:c-1,f(s[l],k),t.playing.timeout=setTimeout(m,r.interval)},h=function m(){clearTimeout(t.playing.timeout),g(s[l],k),l+=1,l=l1&&(this.playing={prev:u,next:h,timeout:setTimeout(h,r.interval)})}return this},stop:function(){var t=this;if(!this.played)return this;var i=this.element,n=this.options;if(p(n.stop)&&d(i,me,n.stop,{once:!0}),A(i,me)===!1)return this;var r=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,y(r.getElementsByTagName("img"),function(a){b(a,z,t.onLoadWhenPlay)}),g(r,q),r.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,n=this.viewer,r=this.image,a=this.list;return!this.isShown||this.played||this.fulled||!i.inline?this:(this.fulled=!0,this.open(),f(this.button,Ht),i.transition&&(g(a,x),this.viewed&&g(r,x)),f(n,It),n.setAttribute("role","dialog"),n.setAttribute("aria-labelledby",this.title.id),n.setAttribute("aria-modal",!0),n.removeAttribute("style"),L(n,{zIndex:i.zIndex}),i.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=C({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){f(r,x),f(a,x)},0)})}),this)},exit:function(){var t=this,i=this.options,n=this.viewer,r=this.image,a=this.list;return!this.isShown||this.played||!this.fulled||!i.inline?this:(this.fulled=!1,this.close(),g(this.button,Ht),i.transition&&(g(a,x),this.viewed&&g(r,x)),i.focus&&this.clearEnforceFocus(),n.removeAttribute("role"),n.removeAttribute("aria-labelledby"),n.removeAttribute("aria-modal"),g(n,It),L(n,{zIndex:i.zIndexInline}),this.viewerData=C({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){f(r,x),f(a,x)},0)})}),this)},tooltip:function(){var t=this,i=this.options,n=this.tooltipBox,r=this.imageData;return!this.viewed||this.played||!i.tooltip?this:(n.textContent="".concat(Math.round(r.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&&A(n,j),f(n,q),f(n,vt),f(n,x),n.removeAttribute("aria-hidden"),n.initialOffsetWidth=n.offsetWidth,f(n,k)):(f(n,q),n.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){i.transition?(d(n,j,function(){g(n,q),g(n,vt),g(n,x),n.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),g(n,k),t.fading=!0):(g(n,q),n.setAttribute("aria-hidden",!0)),t.tooltipping=!1},1e3),this)},toggle:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,t):this.zoomTo(1,!0,null,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=C({},this.initialImageData),this.renderImage()),this},update:function(){var t=this,i=this.element,n=this.options,r=this.isImg;if(r&&!i.parentNode)return this.destroy();var a=[];if(y(r?[i]:i.querySelectorAll("img"),function(l){p(n.filter)?n.filter.call(t,l)&&a.push(l):t.getImageURL(l)&&a.push(l)}),!a.length)return this;if(this.images=a,this.length=a.length,this.ready){var o=[];if(y(this.items,function(l,u){var h=l.querySelector("img"),m=a[u];m&&h?(m.src!==h.src||m.alt!==h.alt)&&o.push(u):o.push(u)}),L(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var s=o.indexOf(this.index);if(s>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-s,this.length-1),0));else{var c=this.items[this.index];f(c,lt),c.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var t=this.element,i=this.options;return t[v]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.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)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||b(t,Q,this.onStart),t[v]=void 0,this):this}},Ii={getImageURL:function(t){var i=this.options.url;return ot(i)?i=t.getAttribute(i):p(i)?i=i.call(this,t):i="",i},enforceFocus:function(){var t=this;this.clearEnforceFocus(),d(document,Bt,this.onFocusin=function(i){var n=t.viewer,r=i.target;if(!(r===document||r===n||n.contains(r))){for(;r;){if(r.getAttribute("tabindex")!==null||r.getAttribute("aria-modal")==="true")return;r=r.parentElement}n.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(b(document,Bt,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;f(t,qt),this.scrollbarWidth>0&&(t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var t=this.body;g(t,qt),this.scrollbarWidth>0&&(t.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var t=this.element,i=this.options,n=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,i.focus&&(n.focus(),this.enforceFocus()),p(i.shown)&&d(t,ie,i.shown,{once:!0}),A(t,ie)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options,n=this.viewer;i.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),f(n,W),n.removeAttribute("role"),n.removeAttribute("aria-labelledby"),n.removeAttribute("aria-modal"),n.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(p(i.hidden)&&d(t,re,i.hidden,{once:!0}),A(t,re,null,{cancelable:!1}))},requestFullscreen:function(t){var i=this.element.ownerDocument;if(this.fulled&&!(i.fullscreenElement||i.webkitFullscreenElement||i.mozFullScreenElement||i.msFullscreenElement)){var n=i.documentElement;n.requestFullscreen?Z(t)?n.requestFullscreen(t):n.requestFullscreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):n.mozRequestFullScreen?n.mozRequestFullScreen():n.msRequestFullscreen&&n.msRequestFullscreen()}},exitFullscreen:function(){var t=this.element.ownerDocument;this.fulled&&(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement)&&(t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen())},change:function(t){var i=this.options,n=this.pointers,r=n[Object.keys(n)[0]];if(r){var a=r.endX-r.startX,o=r.endY-r.startY;switch(this.action){case dt:(a!==0||o!==0)&&(this.pointerMoved=!0,this.move(a,o,t));break;case it:this.zoom(Oi(n),!1,null,t);break;case _e:{this.action="switched";var s=Math.abs(a);s>1&&s>Math.abs(o)&&(this.pointers={},a>1?this.prev(i.loop):a<-1&&this.next(i.loop));break}}y(n,function(c){c.startX=c.endX,c.startY=c.endY})}},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return this.length>1&&t.x>=0&&t.y>=0&&t.width<=i.width&&t.height<=i.height}},Ni=P.Viewer,Ci=function(e){return function(){return e+=1,e}}(-1),Ie=function(){function e(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ii(this,e),!t||t.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=C({},Xt,Z(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=Ci(),this.init()}return ni(e,[{key:"init",value:function(){var i=this,n=this.element,r=this.options;if(!n[v]){n[v]=this,r.focus&&!r.keyboard&&(r.focus=!1);var a=n.localName==="img",o=[];if(y(a?[n]:n.querySelectorAll("img"),function(l){p(r.filter)?r.filter.call(i,l)&&o.push(l):i.getImageURL(l)&&o.push(l)}),this.isImg=a,this.length=o.length,this.images=o,this.initBody(),B(document.createElement(v).style.transition)&&(r.transition=!1),r.inline){var s=0,c=function(){if(s+=1,s===i.length){var u;i.initializing=!1,i.delaying={abort:function(){clearTimeout(u)}},u=setTimeout(function(){i.delaying=!1,i.build()},0)}};this.initializing={abort:function(){y(o,function(u){u.complete||(b(u,z,c),b(u,X,c))})}},y(o,function(l){if(l.complete)c();else{var u,h;d(l,z,u=function(){b(l,X,h),c()},{once:!0}),d(l,X,h=function(){b(l,z,u),c()},{once:!0})}})}else d(n,Q,this.onStart=function(l){var u=l.target;u.localName==="img"&&(!p(r.filter)||r.filter.call(i,u))&&i.view(i.images.indexOf(u))})}}},{key:"build",value:function(){if(!this.ready){var i=this.element,n=this.options,r=i.parentNode,a=document.createElement("div");a.innerHTML=oi;var o=a.querySelector(".".concat(v,"-container")),s=o.querySelector(".".concat(v,"-title")),c=o.querySelector(".".concat(v,"-toolbar")),l=o.querySelector(".".concat(v,"-navbar")),u=o.querySelector(".".concat(v,"-button")),h=o.querySelector(".".concat(v,"-canvas"));if(this.parent=r,this.viewer=o,this.title=s,this.toolbar=c,this.navbar=l,this.button=u,this.canvas=h,this.footer=o.querySelector(".".concat(v,"-footer")),this.tooltipBox=o.querySelector(".".concat(v,"-tooltip")),this.player=o.querySelector(".".concat(v,"-player")),this.list=o.querySelector(".".concat(v,"-list")),o.id="".concat(v).concat(this.id),s.id="".concat(v,"Title").concat(this.id),f(s,n.title?ct(Array.isArray(n.title)?n.title[0]:n.title):W),f(l,n.navbar?ct(n.navbar):W),st(u,W,!n.button),n.keyboard&&u.setAttribute("tabindex",0),n.backdrop&&(f(o,"".concat(v,"-backdrop")),!n.inline&&n.backdrop!=="static"&&Ct(h,gt,"hide")),ot(n.className)&&n.className&&n.className.split(jt).forEach(function(E){f(o,E)}),n.toolbar){var m=document.createElement("ul"),_=Z(n.toolbar),S=ut.slice(0,3),T=ut.slice(7,9),D=ut.slice(9);_||f(c,ct(n.toolbar)),y(_?n.toolbar:ut,function(E,R){var M=_&&Z(E),V=_?Lt(R):E,Y=M&&!B(E.show)?E.show:E;if(!(!Y||!n.zoomable&&S.indexOf(V)!==-1||!n.rotatable&&T.indexOf(V)!==-1||!n.scalable&&D.indexOf(V)!==-1)){var tt=M&&!B(E.size)?E.size:E,H=M&&!B(E.click)?E.click:E,F=document.createElement("li");n.keyboard&&F.setAttribute("tabindex",0),F.setAttribute("role","button"),f(F,"".concat(v,"-").concat(V)),p(H)||Ct(F,gt,V),O(Y)&&f(F,ct(Y)),["small","large"].indexOf(tt)!==-1?f(F,"".concat(v,"-").concat(tt)):V==="play"&&f(F,"".concat(v,"-large")),p(H)&&d(F,Q,H),m.appendChild(F)}}),c.appendChild(m)}else f(c,W);if(!n.rotatable){var I=c.querySelectorAll('li[class*="rotate"]');f(I,nt),y(I,function(E){c.appendChild(E)})}if(n.inline)f(u,li),L(o,{zIndex:n.zIndexInline}),window.getComputedStyle(r).position==="static"&&L(r,{position:"relative"}),r.insertBefore(o,i.nextSibling);else{f(u,si),f(o,It),f(o,vt),f(o,W),L(o,{zIndex:n.zIndex});var N=n.container;ot(N)&&(N=i.ownerDocument.querySelector(N)),N||(N=this.body),N.appendChild(o)}if(n.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,p(n.ready)&&d(i,te,n.ready,{once:!0}),A(i,te)===!1){this.ready=!1;return}this.ready&&n.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Ni,e}},{key:"setDefaults",value:function(i){C(Xt,Z(i)&&i)}}]),e}();C(Ie.prototype,xi,_i,Ai,Di,Ii);var ki=typeof global=="object"&&global&&global.Object===Object&&global;const Ne=ki;var zi=typeof self=="object"&&self&&self.Object===Object&&self,ji=Ne||zi||Function("return this")();const Vt=ji;var Li=Vt.Symbol;const pt=Li;var Ce=Object.prototype,Vi=Ce.hasOwnProperty,Ri=Ce.toString,et=pt?pt.toStringTag:void 0;function Fi(e){var t=Vi.call(e,et),i=e[et];try{e[et]=void 0;var n=!0}catch{}var r=Ri.call(e);return n&&(t?e[et]=i:delete e[et]),r}var Pi=Object.prototype,Mi=Pi.toString;function Yi(e){return Mi.call(e)}var Wi="[object Null]",Xi="[object Undefined]",ge=pt?pt.toStringTag:void 0;function Rt(e){return e==null?e===void 0?Xi:Wi:ge&&ge in Object(e)?Fi(e):Yi(e)}function Ft(e){return e!=null&&typeof e=="object"}var Hi=Array.isArray;const qi=Hi;function wt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ke(e){return e}var Ui="[object AsyncFunction]",Bi="[object Function]",Zi="[object GeneratorFunction]",$i="[object Proxy]";function ze(e){if(!wt(e))return!1;var t=Rt(e);return t==Bi||t==Zi||t==Ui||t==$i}var Ki=Vt["__core-js_shared__"];const xt=Ki;var pe=function(){var e=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Gi(e){return!!pe&&pe in e}var Qi=Function.prototype,Ji=Qi.toString;function tn(e){if(e!=null){try{return Ji.call(e)}catch{}try{return e+""}catch{}}return""}var en=/[\\^$.*+?()[\]{}|]/g,nn=/^\[object .+?Constructor\]$/,rn=Function.prototype,an=Object.prototype,on=rn.toString,sn=an.hasOwnProperty,ln=RegExp("^"+on.call(sn).replace(en,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function un(e){if(!wt(e)||Gi(e))return!1;var t=ze(e)?ln:nn;return t.test(tn(e))}function cn(e,t){return e==null?void 0:e[t]}function hn(e,t){var i=cn(e,t);return un(i)?i:void 0}function fn(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var dn=800,vn=16,mn=Date.now;function gn(e){var t=0,i=0;return function(){var n=mn(),r=vn-(n-i);if(i=n,r>0){if(++t>=dn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function pn(e){return function(){return e}}var bn=function(){try{var e=hn(Object,"defineProperty");return e({},"",{}),e}catch{}}();const bt=bn;var yn=bt?function(e,t){return bt(e,"toString",{configurable:!0,enumerable:!1,value:pn(t),writable:!0})}:ke;const wn=yn;var En=gn(wn);const Tn=En;var On=9007199254740991,Sn=/^(?:0|[1-9]\d*)$/;function je(e,t){var i=typeof e;return t=t??On,!!t&&(i=="number"||i!="symbol"&&Sn.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=In}function Et(e){return e!=null&&Fe(e.length)&&!ze(e)}function Pe(e,t,i){if(!wt(i))return!1;var n=typeof t;return(n=="number"?Et(i)&&je(t,i.length):n=="string"&&t in i)?Pt(i[t],e):!1}function Nn(e){return Re(function(t,i){var n=-1,r=i.length,a=r>1?i[r-1]:void 0,o=r>2?i[2]:void 0;for(a=e.length>3&&typeof a=="function"?(r--,a):void 0,o&&Pe(i[0],i[1],o)&&(a=r<3?void 0:a,r=1),t=Object(t);++n2?t[2]:void 0;for(r&&Pe(t[0],t[1],r)&&(n=1);++i[]},rebuild:{type:Boolean,default:!1},trigger:{type:Object,default:null},options:{type:Object,default:()=>null}},emits:["inited"],setup(e,{emit:t}){let i;const n=qe();function r(){i=new Ie(n.value,e.options),t("inited",i)}function a(){i&&i.destroy()}function o(){a(),r()}function s(){i?(i.update(),t("inited",i)):r()}function c(){e.rebuild?o():s()}const l={deep:!0};return Tt(()=>e.images,()=>{Ot(()=>{c()})},l),Tt(()=>e.trigger,()=>{Ot(()=>{c()})},l),Tt(()=>e.options,()=>{Ot(()=>{o()})},l),Ue(()=>r()),Be(()=>a()),{root:n,createViewer:r,rebuildViewer:o,updateViewer:s,destroyViewer:a}}}),Rr=(e,t)=>{const i=e.__vccOpts||e;for(const[n,r]of t)i[n]=r;return i},Fr={ref:"root"};function Pr(e,t,i,n,r,a){return ft(),At("div",Fr,[Ze(e.$slots,"default",{images:e.images,options:e.options})],512)}const Mr=Rr(Vr,[["render",Pr]]);const Yr=["src"],Wr=Se({__name:"ImageViewer",props:{image:{}},setup(e){const t=e,i=$e(()=>t.image?[{src:t.image,index:0}]:[]);return(n,r)=>(ft(),Ke(Qe(Mr),{images:i.value,style:{height:"100%"}},{default:Ge(()=>[(ft(!0),At(ti,null,Je(i.value,a=>(ft(),At("img",{alt:"图片",src:a.src,key:a.index,class:"image"},null,8,Yr))),128))]),_:1},8,["images"]))}});const Hr=ei(Wr,[["__scopeId","data-v-b0f61c51"]]);export{Hr as default};