import{b2 as te,b8 as N,ch as se,be as ne,d as M,bK as oe,b4 as ie,bn as re,dK as ce,r as c,b as u,bv as f,aS as ue,B as de,o as i,c as d,aJ as x,g as $,t as ve,a,W as g,F as A,ai as pe,a4 as m,l as fe,w as me,av as ye,b6 as ge,am as we,dL as be,bf as he,dM as _e,cO as K,dN as ke,dO as Se,b7 as xe,__tla as ze}from"./index-82e357b2.js";import{E as Ee,__tla as Oe}from"./el-image-viewer-812f8e38.js";let P,Le=Promise.all([(()=>{try{return ze}catch{}})(),(()=>{try{return Oe}catch{}})()]).then(async()=>{const T=te({hideOnClickModal:Boolean,src:{type:String,default:""},fit:{type:String,values:["","contain","cover","fill","none","scale-down"],default:""},loading:{type:String,values:["eager","lazy"]},lazy:Boolean,scrollContainer:{type:N([String,Object])},previewSrcList:{type:N(Array),default:()=>se([])},previewTeleported:Boolean,zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7}}),R={load:n=>n instanceof Event,error:n=>n instanceof Event,switch:n=>ne(n),close:()=>!0,show:()=>!0},j=["src","loading"],F={key:0},Y=M({name:"ElImage",inheritAttrs:!1});P=xe(ge(M({...Y,props:T,emits:R,setup(n,{emit:v}){const l=n;let z="";const{t:q}=oe(),o=ie("image"),D=re(),H=ce(),w=c(),p=c(!1),r=c(!0),b=c(!1),y=c(),s=c(),J=f&&"loading"in HTMLImageElement.prototype;let h,_;const W=u(()=>[o.e("inner"),k.value&&o.e("preview"),r.value&&o.is("loading")]),G=u(()=>D.style),Q=u(()=>{const{fit:e}=l;return f&&e?{objectFit:e}:{}}),k=u(()=>{const{previewSrcList:e}=l;return Array.isArray(e)&&e.length>0}),U=u(()=>{const{previewSrcList:e,initialIndex:t}=l;let I=t;return t>e.length-1&&(I=0),I}),E=u(()=>l.loading!=="eager"&&(!J&&l.loading==="lazy"||l.lazy)),S=()=>{f&&(r.value=!0,p.value=!1,w.value=l.src)};function V(e){r.value=!1,p.value=!1,v("load",e)}function X(e){r.value=!1,p.value=!0,v("error",e)}function O(){ke(y.value,s.value)&&(S(),C())}const L=Se(O,200,!0);async function B(){var e;if(!f)return;await we();const{scrollContainer:t}=l;be(t)?s.value=t:he(t)&&t!==""?s.value=(e=document.querySelector(t))!=null?e:void 0:y.value&&(s.value=_e(y.value)),s.value&&(h=K(s,"scroll",L),setTimeout(()=>O(),100))}function C(){f&&s.value&&L&&(h==null||h(),s.value=void 0)}function Z(e){if(e.ctrlKey)return e.deltaY<0||e.deltaY>0?(e.preventDefault(),!1):void 0}function ee(){k.value&&(_=K("wheel",Z,{passive:!1}),z=document.body.style.overflow,document.body.style.overflow="hidden",b.value=!0,v("show"))}function ae(){_==null||_(),document.body.style.overflow=z,b.value=!1,v("close")}function le(e){v("switch",e)}return ue(()=>l.src,()=>{E.value?(r.value=!0,p.value=!1,C(),B()):S()}),de(()=>{E.value?B():S()}),(e,t)=>(i(),d("div",{ref_key:"container",ref:y,class:g([a(o).b(),e.$attrs.class]),style:ye(a(G))},[p.value?x(e.$slots,"error",{key:0},()=>[$("div",{class:g(a(o).e("error"))},ve(a(q)("el.image.error")),3)]):(i(),d(A,{key:1},[w.value!==void 0?(i(),d("img",pe({key:0},a(H),{src:w.value,loading:e.loading,style:a(Q),class:a(W),onClick:ee,onLoad:V,onError:X}),null,16,j)):m("v-if",!0),r.value?(i(),d("div",{key:1,class:g(a(o).e("wrapper"))},[x(e.$slots,"placeholder",{},()=>[$("div",{class:g(a(o).e("placeholder"))},null,2)])],2)):m("v-if",!0)],64)),a(k)?(i(),d(A,{key:2},[b.value?(i(),fe(a(Ee),{key:0,"z-index":e.zIndex,"initial-index":a(U),infinite:e.infinite,"zoom-rate":e.zoomRate,"min-scale":e.minScale,"max-scale":e.maxScale,"url-list":e.previewSrcList,"hide-on-click-modal":e.hideOnClickModal,teleported:e.previewTeleported,"close-on-press-escape":e.closeOnPressEscape,onClose:ae,onSwitch:le},{default:me(()=>[e.$slots.viewer?(i(),d("div",F,[x(e.$slots,"viewer")])):m("v-if",!0)]),_:3},8,["z-index","initial-index","infinite","zoom-rate","min-scale","max-scale","url-list","hide-on-click-modal","teleported","close-on-press-escape"])):m("v-if",!0)],64)):m("v-if",!0)],6))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]))});export{P as E,Le as __tla};