(function(l,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("vue")):typeof define=="function"&&define.amd?define(["vue"],r):(l=typeof globalThis<"u"?globalThis:l||self,l.vue3ImageView=r(l.Vue))})(this,function(l){"use strict";const r=(s,i)=>{const d=s.__vccOpts||s;for(const[u,t]of i)d[u]=t;return d},_={},w={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},x=[l.createElementVNode("path",{d:"M13.4099 11.9999L17.7099 7.70994C17.8982 7.52164 18.004 7.26624 18.004 6.99994C18.004 6.73364 17.8982 6.47825 17.7099 6.28994C17.5216 6.10164 17.2662 5.99585 16.9999 5.99585C16.7336 5.99585 16.4782 6.10164 16.2899 6.28994L11.9999 10.5899L7.70994 6.28994C7.52164 6.10164 7.26624 5.99585 6.99994 5.99585C6.73364 5.99585 6.47824 6.10164 6.28994 6.28994C6.10164 6.47825 5.99585 6.73364 5.99585 6.99994C5.99585 7.26624 6.10164 7.52164 6.28994 7.70994L10.5899 11.9999L6.28994 16.2899C6.19621 16.3829 6.12182 16.4935 6.07105 16.6154C6.02028 16.7372 5.99414 16.8679 5.99414 16.9999C5.99414 17.132 6.02028 17.2627 6.07105 17.3845C6.12182 17.5064 6.19621 17.617 6.28994 17.7099C6.3829 17.8037 6.4935 17.8781 6.61536 17.9288C6.73722 17.9796 6.86793 18.0057 6.99994 18.0057C7.13195 18.0057 7.26266 17.9796 7.38452 17.9288C7.50638 17.8781 7.61698 17.8037 7.70994 17.7099L11.9999 13.4099L16.2899 17.7099C16.3829 17.8037 16.4935 17.8781 16.6154 17.9288C16.7372 17.9796 16.8679 18.0057 16.9999 18.0057C17.132 18.0057 17.2627 17.9796 17.3845 17.9288C17.5064 17.8781 17.617 17.8037 17.7099 17.7099C17.8037 17.617 17.8781 17.5064 17.9288 17.3845C17.9796 17.2627 18.0057 17.132 18.0057 16.9999C18.0057 16.8679 17.9796 16.7372 17.9288 16.6154C17.8781 16.4935 17.8037 16.3829 17.7099 16.2899L13.4099 11.9999Z",fill:"#f2f2f2"},null,-1)];function $(s,i){return l.openBlock(),l.createElementBlock("svg",w,x)}const b=r(_,[["render",$]]),y={},k={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},N=[l.createElementVNode("path",{d:"M3 11C3.26521 11 3.51957 11.1054 3.7071 11.2929C3.89464 11.4804 4 11.7348 4 12C3.98809 13.873 4.62971 15.6916 5.81434 17.1425C6.99897 18.5933 8.65247 19.5857 10.49 19.9486C12.3276 20.3115 14.2342 20.0223 15.8815 19.1308C17.5288 18.2392 18.8136 16.8012 19.5147 15.0643C20.2158 13.3273 20.2892 11.4003 19.7224 9.61508C19.1556 7.82983 17.9839 6.29813 16.4093 5.28378C14.8347 4.26942 12.9556 3.83591 11.0957 4.05791C9.23587 4.27991 7.51164 5.14352 6.22 6.5H8.62C8.88521 6.5 9.13957 6.60536 9.3271 6.79289C9.51464 6.98043 9.62 7.23478 9.62 7.5C9.62 7.76522 9.51464 8.01957 9.3271 8.20711C9.13957 8.39464 8.88521 8.5 8.62 8.5H4.09C3.82478 8.5 3.57043 8.39464 3.38289 8.20711C3.19535 8.01957 3.09 7.76522 3.09 7.5V3C3.09 2.73478 3.19535 2.48043 3.38289 2.29289C3.57043 2.10536 3.82478 2 4.09 2C4.35521 2 4.60957 2.10536 4.7971 2.29289C4.98464 2.48043 5.09 2.73478 5.09 3V4.77C6.75533 3.17806 8.91925 2.20995 11.216 2.02933C13.5127 1.84871 15.8014 2.46664 17.6951 3.77869C19.5888 5.09074 20.9714 7.01641 21.6092 9.23019C22.2469 11.444 22.1008 13.8101 21.1954 15.9285C20.29 18.047 18.6809 19.7878 16.6401 20.8568C14.5993 21.9258 12.252 22.2574 9.99496 21.7955C7.73792 21.3336 5.7096 20.1065 4.25286 18.3217C2.79613 16.5369 2.00033 14.3038 2 12C2 11.7348 2.10535 11.4804 2.29289 11.2929C2.48042 11.1054 2.73478 11 3 11Z",fill:"#f2f2f2"},null,-1)];function B(s,i){return l.openBlock(),l.createElementBlock("svg",k,N)}const V=r(y,[["render",B]]),E={},M={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L=[l.createElementVNode("path",{d:"M21 11C20.7348 11 20.4804 11.1054 20.2929 11.2929C20.1054 11.4804 20 11.7348 20 12C20.0119 13.873 19.3703 15.6916 18.1857 17.1425C17.001 18.5933 15.3475 19.5857 13.51 19.9486C11.6724 20.3115 9.76578 20.0223 8.11851 19.1308C6.47123 18.2392 5.18641 16.8012 4.48533 15.0643C3.78425 13.3273 3.71079 11.4003 4.27762 9.61508C4.84445 7.82983 6.01607 6.29813 7.5907 5.28378C9.16533 4.26942 11.0444 3.83591 12.9043 4.05791C14.7641 4.27991 16.4884 5.14352 17.78 6.5H15.38C15.1148 6.5 14.8604 6.60536 14.6729 6.79289C14.4854 6.98043 14.38 7.23478 14.38 7.5C14.38 7.76522 14.4854 8.01957 14.6729 8.20711C14.8604 8.39464 15.1148 8.5 15.38 8.5H19.91C20.1752 8.5 20.4296 8.39464 20.6171 8.20711C20.8046 8.01957 20.91 7.76522 20.91 7.5V3C20.91 2.73478 20.8046 2.48043 20.6171 2.29289C20.4296 2.10536 20.1752 2 19.91 2C19.6448 2 19.3904 2.10536 19.2029 2.29289C19.0154 2.48043 18.91 2.73478 18.91 3V4.77C17.2447 3.17806 15.0808 2.20995 12.784 2.02933C10.4873 1.84871 8.19863 2.46664 6.30492 3.77869C4.41121 5.09074 3.02861 7.01641 2.39083 9.23019C1.75305 11.444 1.89921 13.8101 2.80461 15.9285C3.71001 18.047 5.31911 19.7878 7.3599 20.8568C9.40069 21.9258 11.748 22.2574 14.005 21.7955C16.2621 21.3336 18.2904 20.1065 19.7471 18.3217C21.2039 16.5369 21.9997 14.3038 22 12C22 11.7348 21.8946 11.4804 21.7071 11.2929C21.5196 11.1054 21.2652 11 21 11Z",fill:"#f2f2f2"},null,-1)];function X(s,i){return l.openBlock(),l.createElementBlock("svg",M,L)}const Y=r(E,[["render",X]]),S={},T={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},H=[l.createElementVNode("path",{d:"M14.9999 10H11.9999V7.00003C11.9999 6.73481 11.8945 6.48046 11.707 6.29292C11.5195 6.10538 11.2651 6.00003 10.9999 6.00003C10.7347 6.00003 10.4803 6.10538 10.2928 6.29292C10.1053 6.48046 9.9999 6.73481 9.9999 7.00003V10H6.9999C6.73469 10 6.48033 10.1054 6.2928 10.2929C6.10526 10.4805 5.9999 10.7348 5.9999 11C5.9999 11.2652 6.10526 11.5196 6.2928 11.7071C6.48033 11.8947 6.73469 12 6.9999 12H9.9999V15C9.9999 15.2652 10.1053 15.5196 10.2928 15.7071C10.4803 15.8947 10.7347 16 10.9999 16C11.2651 16 11.5195 15.8947 11.707 15.7071C11.8945 15.5196 11.9999 15.2652 11.9999 15V12H14.9999C15.2651 12 15.5195 11.8947 15.707 11.7071C15.8945 11.5196 15.9999 11.2652 15.9999 11C15.9999 10.7348 15.8945 10.4805 15.707 10.2929C15.5195 10.1054 15.2651 10 14.9999 10ZM21.7099 20.29L17.9999 16.61C19.44 14.8144 20.1374 12.5353 19.9487 10.2413C19.76 7.94733 18.6996 5.81281 16.9854 4.27667C15.2713 2.74053 13.0337 1.91954 10.7328 1.9825C8.43194 2.04546 6.24263 2.98759 4.61505 4.61517C2.98747 6.24275 2.04534 8.43207 1.98237 10.7329C1.91941 13.0338 2.74041 15.2714 4.27655 16.9855C5.81269 18.6997 7.94721 19.7601 10.2412 19.9488C12.5352 20.1375 14.8143 19.4401 16.6099 18L20.2899 21.68C20.3829 21.7738 20.4935 21.8482 20.6153 21.8989C20.7372 21.9497 20.8679 21.9758 20.9999 21.9758C21.1319 21.9758 21.2626 21.9497 21.3845 21.8989C21.5063 21.8482 21.6169 21.7738 21.7099 21.68C21.8901 21.4936 21.9909 21.2444 21.9909 20.985C21.9909 20.7257 21.8901 20.4765 21.7099 20.29ZM10.9999 18C9.61544 18 8.26206 17.5895 7.11091 16.8203C5.95977 16.0511 5.06256 14.9579 4.53275 13.6788C4.00293 12.3997 3.86431 10.9923 4.13441 9.63439C4.4045 8.27653 5.07119 7.02925 6.05016 6.05028C7.02912 5.07131 8.27641 4.40463 9.63427 4.13453C10.9921 3.86443 12.3996 4.00306 13.6787 4.53287C14.9578 5.06268 16.051 5.95989 16.8202 7.11103C17.5894 8.26218 17.9999 9.61556 17.9999 11C17.9999 12.8565 17.2624 14.637 15.9497 15.9498C14.6369 17.2625 12.8564 18 10.9999 18Z",fill:"#f2f2f2"},null,-1)];function Z(s,i){return l.openBlock(),l.createElementBlock("svg",T,H)}const D=r(S,[["render",Z]]),I={},O={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},z=[l.createElementVNode("path",{d:"M21.7099 20.29L17.9999 16.61C19.44 14.8144 20.1374 12.5353 19.9487 10.2413C19.76 7.94733 18.6996 5.81281 16.9854 4.27667C15.2713 2.74053 13.0337 1.91954 10.7328 1.9825C8.43194 2.04546 6.24263 2.98759 4.61505 4.61517C2.98747 6.24275 2.04534 8.43207 1.98237 10.7329C1.91941 13.0338 2.74041 15.2714 4.27655 16.9855C5.81269 18.6997 7.94721 19.7601 10.2412 19.9488C12.5352 20.1375 14.8143 19.4401 16.6099 18L20.2899 21.68C20.3829 21.7738 20.4935 21.8482 20.6153 21.8989C20.7372 21.9497 20.8679 21.9758 20.9999 21.9758C21.1319 21.9758 21.2626 21.9497 21.3845 21.8989C21.5063 21.8482 21.6169 21.7738 21.7099 21.68C21.8901 21.4936 21.9909 21.2444 21.9909 20.985C21.9909 20.7257 21.8901 20.4765 21.7099 20.29ZM10.9999 18C9.61544 18 8.26206 17.5895 7.11091 16.8203C5.95977 16.0511 5.06256 14.9579 4.53275 13.6788C4.00293 12.3997 3.86431 10.9923 4.13441 9.63439C4.4045 8.27653 5.07119 7.02925 6.05016 6.05028C7.02912 5.07131 8.27641 4.40463 9.63427 4.13453C10.9921 3.86443 12.3996 4.00306 13.6787 4.53287C14.9578 5.06268 16.051 5.95989 16.8202 7.11103C17.5894 8.26218 17.9999 9.61556 17.9999 11C17.9999 12.8565 17.2624 14.637 15.9497 15.9498C14.6369 17.2625 12.8564 18 10.9999 18ZM14.9999 10H6.9999C6.73469 10 6.48033 10.1054 6.2928 10.2929C6.10526 10.4805 5.9999 10.7348 5.9999 11C5.9999 11.2652 6.10526 11.5196 6.2928 11.7071C6.48033 11.8947 6.73469 12 6.9999 12H14.9999C15.2651 12 15.5195 11.8947 15.707 11.7071C15.8945 11.5196 15.9999 11.2652 15.9999 11C15.9999 10.7348 15.8945 10.4805 15.707 10.2929C15.5195 10.1054 15.2651 10 14.9999 10Z",fill:"#f2f2f2"},null,-1)];function R(s,i){return l.openBlock(),l.createElementBlock("svg",O,z)}const F=r(I,[["render",R]]),J={class:"v-image-view-container notranslate"},W={key:0,class:"v-image-view-nav"},q=["onMouseenter","onMouseleave","onClick"],A={class:"v-image-view-content"},P=["onMouseover","onMouseenter","onMouseleave","onDrag","onDragstart"],j=["src"],U=l.defineComponent({__name:"vue3-image-view",props:{controllerBtnText:{type:String,default:""},imageWrap:{type:Object,default:{image1:""}},navController:{type:Boolean,default:!0},imageController:{type:Boolean,default:!0}},emits:["console"],setup(s,{emit:i}){const d=s,u=l.computed(()=>JSON.parse(JSON.stringify(d.imageWrap))),t=l.ref(JSON.parse(JSON.stringify(u.value))),c=l.ref(!1),m=l.ref(null),v=l.ref({url:"",left:!0,index:0,hover:!1,rotate:0,selected:!1}),G=e=>{e.wheelDelta>0||e.detail<0?f():g()},K=e=>{if(event.clientX!==0||event.clientY!==0){let n=-(t.value[e].moveX-event.clientX-Number(t.value[e].saveTranslate3d[0]))+"px",o=-(t.value[e].moveY-event.clientY-Number(t.value[e].saveTranslate3d[1]))+"px";t.value[e].translate3d=`${n},${o},0px`}},Q=e=>{t.value[e].moveX=event.clientX,t.value[e].moveY=event.clientY;for(let n=0;n{const e=v.value.index;t.value[e].rotate=t.value[e].rotate+90},t1=()=>{const e=v.value.index;t.value[e].rotate=t.value[e].rotate-90},f=()=>{const e=v.value.index,n=document.querySelectorAll(".v-image-view-image-control-box")[e];t.value[e].scale=Number((t.value[e].scale+.1).toFixed(1)),t.value[e].width=Number((t.value[e].fixWidth*t.value[e].scale).toFixed(1)),n.style.width=t.value[e].width+"px"},g=()=>{const e=v.value.index,n=document.querySelectorAll(".v-image-view-image-control-box")[e];t.value[e].scale>.5&&(t.value[e].scale=Number((t.value[e].scale-.1).toFixed(1)),t.value[e].width=Number((t.value[e].fixWidth*t.value[e].scale).toFixed(1)),n.style.width=t.value[e].width+"px")},h=e=>{v.value=t.value[e];for(let n=0;n{e.stopPropagation(),e.key.toLowerCase()==="escape"&&(c.value=!1)};return l.watch(c,()=>{if(c.value)setTimeout(()=>{m.value.focus(),m.value.click();const e=document.querySelectorAll(".v-image-view-image-control-box");for(let n=0;n{window.addEventListener("keyup",p),t.value=JSON.parse(JSON.stringify(u.value));for(let e=0;e{window.removeEventListener("keyup",p);for(let e=0;e(l.openBlock(),l.createElementBlock("div",J,[l.createElementVNode("button",{type:"button",class:"v-image-view-controller-btn",onClick:n[0]||(n[0]=o=>c.value=!c.value)},l.toDisplayString(d.controllerBtnText),1),c.value?(l.openBlock(),l.createBlock(l.Teleport,{key:0,to:"body"},[l.createElementVNode("div",{class:l.normalizeClass(["v-image-view-wrapper notranslate",{show:c.value}])},[l.createElementVNode("button",{type:"button",style:{opacity:"0","pointer-events":"none"},ref_key:"RefImageView",ref:m},null,512),d.navController?(l.openBlock(),l.createElementBlock("div",W,[l.createElementVNode("button",{type:"button",class:"v-image-view-nav-controller-btn",onClick:n[1]||(n[1]=o=>c.value=!1)},[l.createVNode(b)]),l.createElementVNode("button",{type:"button",class:"v-image-view-nav-controller-btn",onClick:n[2]||(n[2]=o=>e1())},[l.createVNode(Y)]),l.createElementVNode("button",{type:"button",class:"v-image-view-nav-controller-btn",onClick:n[3]||(n[3]=o=>t1())},[l.createVNode(V)]),l.createElementVNode("button",{type:"button",class:"v-image-view-nav-controller-btn",onClick:n[4]||(n[4]=o=>f())},[l.createVNode(D)]),l.createElementVNode("button",{type:"button",class:"v-image-view-nav-controller-btn",onClick:n[5]||(n[5]=o=>g())},[l.createVNode(F)]),l.createElementVNode("div",null,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.value,(o,a)=>(l.openBlock(),l.createElementBlock("button",{type:"button",class:l.normalizeClass(["v-image-view-nav-controller-btn",{selected:v.value.index===Number(a)}]),key:a,onMouseenter:C=>o.hover=!0,onMouseleave:C=>o.hover=!1,onClick:C=>h(Number(a))},l.toDisplayString(a+1),43,q))),128))])])):l.createCommentVNode("",!0),l.createElementVNode("div",A,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.value,(o,a)=>(l.openBlock(),l.createElementBlock("div",{key:a,class:l.normalizeClass(["v-image-view-image-control-box",{left:(a===0||a===1)&&t.value.length===3,right:a===2,bottom:a===1,selected:o.selected,hover:o.hover}]),onMouseover:C=>h(Number(a)),onWheel:G,onMouseenter:C=>o.hover=!0,onMouseleave:C=>o.hover=!1,onDrag:C=>K(Number(a)),onDragstart:C=>Q(Number(a)),style:l.normalizeStyle({transform:`translate3d(${o.translate3d})`}),draggable:"true"},[l.createElementVNode("img",{src:o.url,class:l.normalizeClass(["v-image-view-image",{hover:o.hover}]),style:l.normalizeStyle({transform:`rotate(${o.rotate}deg)`}),draggable:"false"},null,14,j)],46,P))),128))])],2)])):l.createCommentVNode("",!0)]))}}),r1="";return{install:(s,i)=>{s.component("vue3-image-view",U)}}});