import{V as $}from"./viewerjs-c43574b2.js";import"./vue-20eed888.js";import{ah as q,as as R,w as T,n as M,d as gt,r as mt,f as ht,Y as jt,o as wt,c as Ot,J as _t}from"./@vue-e95c845e.js";var $t=typeof global=="object"&&global&&global.Object===Object&&global;const tt=$t;var At=typeof self=="object"&&self&&self.Object===Object&&self,xt=tt||At||Function("return this")();const E=xt;var Tt=E.Symbol;const S=Tt;var rt=Object.prototype,Mt=rt.hasOwnProperty,St=rt.toString,O=S?S.toStringTag:void 0;function Vt(t){var r=Mt.call(t,O),e=t[O];try{t[O]=void 0;var n=!0}catch{}var o=St.call(t);return n&&(r?t[O]=e:delete t[O]),o}var Et=Object.prototype,Pt=Et.toString;function Dt(t){return Pt.call(t)}var Ut="[object Null]",Ft="[object Undefined]",N=S?S.toStringTag:void 0;function P(t){return t==null?t===void 0?Ft:Ut:N&&N in Object(t)?Vt(t):Dt(t)}function D(t){return t!=null&&typeof t=="object"}var It="[object Symbol]";function Ct(t){return typeof t=="symbol"||D(t)&&P(t)==It}var kt=Array.isArray;const Bt=kt;var Wt=/\s/;function Lt(t){for(var r=t.length;r--&&Wt.test(t.charAt(r)););return r}var qt=/^\s+/;function Rt(t){return t&&t.slice(0,Lt(t)+1).replace(qt,"")}function g(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}var z=0/0,Nt=/^[-+]0x[0-9a-f]+$/i,zt=/^0b[01]+$/i,Ht=/^0o[0-7]+$/i,Jt=parseInt;function H(t){if(typeof t=="number")return t;if(Ct(t))return z;if(g(t)){var r=typeof t.valueOf=="function"?t.valueOf():t;t=g(r)?r+"":r}if(typeof t!="string")return t===0?t:+t;t=Rt(t);var e=zt.test(t);return e||Ht.test(t)?Jt(t.slice(2),e?2:8):Nt.test(t)?z:+t}function et(t){return t}var Yt="[object AsyncFunction]",Gt="[object Function]",Kt="[object GeneratorFunction]",Qt="[object Proxy]";function nt(t){if(!g(t))return!1;var r=P(t);return r==Gt||r==Kt||r==Yt||r==Qt}var Xt=E["__core-js_shared__"];const I=Xt;var J=function(){var t=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Zt(t){return!!J&&J in t}var tr=Function.prototype,rr=tr.toString;function er(t){if(t!=null){try{return rr.call(t)}catch{}try{return t+""}catch{}}return""}var nr=/[\\^$.*+?()[\]{}|]/g,or=/^\[object .+?Constructor\]$/,ir=Function.prototype,ur=Object.prototype,cr=ir.toString,ar=ur.hasOwnProperty,fr=RegExp("^"+cr.call(ar).replace(nr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sr(t){if(!g(t)||Zt(t))return!1;var r=nt(t)?fr:or;return r.test(er(t))}function lr(t,r){return t==null?void 0:t[r]}function vr(t,r){var e=lr(t,r);return sr(e)?e:void 0}function dr(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var pr=800,br=16,yr=Date.now;function gr(t){var r=0,e=0;return function(){var n=yr(),o=br-(n-e);if(e=n,o>0){if(++r>=pr)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}function mr(t){return function(){return t}}var hr=function(){try{var t=vr(Object,"defineProperty");return t({},"",{}),t}catch{}}();const V=hr;var jr=V?function(t,r){return V(t,"toString",{configurable:!0,enumerable:!1,value:mr(r),writable:!0})}:et;const wr=jr;var Or=gr(wr);const _r=Or;var $r=9007199254740991,Ar=/^(?:0|[1-9]\d*)$/;function ot(t,r){var e=typeof t;return r=r??$r,!!r&&(e=="number"||e!="symbol"&&Ar.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=Vr}function U(t){return t!=null&&at(t.length)&&!nt(t)}function ft(t,r,e){if(!g(e))return!1;var n=typeof r;return(n=="number"?U(e)&&ot(r,e.length):n=="string"&&r in e)?B(e[r],t):!1}function Er(t){return ct(function(r,e){var n=-1,o=e.length,a=o>1?e[o-1]:void 0,f=o>2?e[2]:void 0;for(a=t.length>3&&typeof a=="function"?(o--,a):void 0,f&&ft(e[0],e[1],f)&&(a=o<3?void 0:a,o=1),r=Object(r);++n=r||y<0||l&&w>=a}function h(){var d=k();if(A(d))return x(d);u=setTimeout(h,j(d))}function x(d){return u=void 0,p&&n?b(d):(n=o=void 0,f)}function bt(){u!==void 0&&clearTimeout(u),c=0,n=v=o=u=void 0}function yt(){return u===void 0?f:x(k())}function F(){var d=k(),y=A(d);if(n=arguments,o=this,v=d,y){if(u===void 0)return m(v);if(l)return clearTimeout(u),u=setTimeout(h,r),b(v)}return u===void 0&&(u=setTimeout(h,r)),f}return F.cancel=bt,F.flush=yt,F}var pt=Object.prototype,Re=pt.hasOwnProperty,Ne=ct(function(t,r){t=Object(t);var e=-1,n=r.length,o=n>2?r[2]:void 0;for(o&&ft(r[0],r[1],o)&&(n=1);++e{r=Pe(r,{inline:!1});const e=document.createElement("div"),n=q("div",{style:{display:"none"},class:["__viewer-token"]},t.map(u=>q("img",typeof u=="string"?{src:u}:u)));R(n,e);const o=e.firstElementChild;document.body.appendChild(o);const a=new $(o,r),f=a.destroy.bind(a);return a.destroy=function(){return f(),R(null,e),a},a.show(),o.addEventListener("hidden",function(){this.viewer===a&&a.destroy()}),a},Je=({name:t="viewer",debug:r=!1}={})=>{async function e(i,l,p=!1,b=!1){await M(),!(b&&!n(i))&&(p||!i[`$${t}`]?(f(i),i[`$${t}`]=new $(i,l),c("Viewer created")):(i[`$${t}`].update(),c("Viewer updated")))}function n(i){const l=i.innerHTML.match(//g),p=l?l.join(""):void 0;return i.__viewerImageDiffCache===p?(c("Element change detected, but image(s) has not changed"),!1):(c("Image change detected"),i.__viewerImageDiffCache=p,!0)}function o(i,l,p,b){u(i);const m=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(!m){c("Observer not supported");return}const j=new m(h=>{h.forEach(x=>{c(`Viewer mutation:${x.type}`),p(i,l,b,!0)})}),A={attributes:!0,childList:!0,characterData:!0,subtree:!0};j.observe(i,A),i.__viewerMutationObserver=j,c("Observer created")}function a(i,l,p,b){i.__viewerUnwatch=T(()=>l.value,(m,j)=>{c("Change detected by watcher: ",l.value),b(i,m,!0,!1)},{deep:!0}),c("Watcher created, expression: ",l.value)}function f(i){!i[`$${t}`]||(i[`$${t}`].destroy(),delete i[`$${t}`],c("Viewer destroyed"))}function u(i){!i.__viewerMutationObserver||(i.__viewerMutationObserver.disconnect(),delete i.__viewerMutationObserver,c("observer destroyed"))}function v(i){!i.__viewerUnwatch||(i.__viewerUnwatch(),delete i.__viewerUnwatch,c("Watcher destroyed"))}function c(...i){r&&console.log(...i)}return{mounted(i,l,p){c("Viewer bind");const b=qe(e,50);b(i,l.value),a(i,l,p,b),l.modifiers.static||o(i,l.value,b,l.modifiers.rebuild)},unmounted(i){c("Viewer unbind"),u(i),v(i),f(i)}}},Ye=gt({name:"Viewer",props:{images:{type:Array,default:()=>[]},rebuild:{type:Boolean,default:!1},trigger:{type:Object,default:null},options:{type:Object,default:()=>null}},emits:["inited"],setup(t,{emit:r}){let e;const n=mt();function o(){e=new $(n.value,t.options),r("inited",e)}function a(){e&&e.destroy()}function f(){a(),o()}function u(){e?(e.update(),r("inited",e)):o()}function v(){t.rebuild?f():u()}const c={deep:!0};return T(()=>t.images,()=>{M(()=>{v()})},c),T(()=>t.trigger,()=>{M(()=>{v()})},c),T(()=>t.options,()=>{M(()=>{f()})},c),ht(()=>o()),jt(()=>a()),{root:n,createViewer:o,rebuildViewer:f,updateViewer:u,destroyViewer:a}}}),Ge=(t,r)=>{const e=t.__vccOpts||t;for(const[n,o]of r)e[n]=o;return e},Ke={ref:"root"};function Qe(t,r,e,n,o,a){return wt(),Ot("div",Ke,[_t(t.$slots,"default",{images:t.images,options:t.options})],512)}const Xe=Ge(Ye,[["render",Qe]]),en={install(t,{name:r="viewer",debug:e=!1,defaultOptions:n}={}){n&&$.setDefaults(n),t.config.globalProperties[`$${r}Api`]=He,t.component(r,ze(Xe,{name:r})),t.directive(r,Je({name:r,debug:e}))},setDefaults(t){$.setDefaults(t)}};export{He as q,en as r};