import{aY as te,aZ as M,b4 as se,bH as ne,d as N,bf as oe,a_ as ie,bF as re,c9 as ce,r as c,Y as u,bI as f,aM as ue,q as de,o as i,c as d,aC as S,g as O,t as ve,a,T as g,F as T,af as pe,a0 as m,x as fe,w as me,ao as ye,a$ as ge,aj as we,ca as he,bK as be,cb as _e,c6 as Y,cc as ke,cd as xe,b0 as Se,__tla as ze}from"./index-8dc1e40a.js";import{E as Ee,__tla as Ie}from"./el-image-viewer-3b8905e6.js";let A,Ce=Promise.all([(()=>{try{return ze}catch{}})(),(()=>{try{return Ie}catch{}})()]).then(async()=>{const j=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:M([String,Object])},previewSrcList:{type:M(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}}),F={load:n=>n instanceof Event,error:n=>n instanceof Event,switch:n=>ne(n),close:()=>!0,show:()=>!0},H=["src","loading"],K={key:0},P=N({name:"ElImage",inheritAttrs:!1});A=Se(ge(N({...P,props:j,emits:F,setup(n,{emit:v}){const l=n;let z="";const{t:q}=oe(),o=ie("image"),R=re(),D=ce(),w=c(),p=c(!1),r=c(!0),h=c(!1),y=c(),s=c(),Z=f&&"loading"in HTMLImageElement.prototype;let b,_;const G=u(()=>[o.e("inner"),k.value&&o.e("preview"),r.value&&o.is("loading")]),J=u(()=>R.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 B=t;return t>e.length-1&&(B=0),B}),E=u(()=>l.loading!=="eager"&&(!Z&&l.loading==="lazy"||l.lazy)),x=()=>{f&&(r.value=!0,p.value=!1,w.value=l.src)};function V(e){r.value=!1,p.value=!1,v("load",e)}function W(e){r.value=!1,p.value=!0,v("error",e)}function I(){ke(y.value,s.value)&&(x(),$())}const C=xe(I,200,!0);async function L(){var e;if(!f)return;await we();const{scrollContainer:t}=l;he(t)?s.value=t:be(t)&&t!==""?s.value=(e=document.querySelector(t))!=null?e:void 0:y.value&&(s.value=_e(y.value)),s.value&&(b=Y(s,"scroll",C),setTimeout(()=>I(),100))}function $(){f&&s.value&&C&&(b==null||b(),s.value=void 0)}function X(e){if(e.ctrlKey)return e.deltaY<0||e.deltaY>0?(e.preventDefault(),!1):void 0}function ee(){k.value&&(_=Y("wheel",X,{passive:!1}),z=document.body.style.overflow,document.body.style.overflow="hidden",h.value=!0,v("show"))}function ae(){_==null||_(),document.body.style.overflow=z,h.value=!1,v("close")}function le(e){v("switch",e)}return ue(()=>l.src,()=>{E.value?(r.value=!0,p.value=!1,$(),L()):x()}),de(()=>{E.value?L():x()}),(e,t)=>(i(),d("div",{ref_key:"container",ref:y,class:g([a(o).b(),e.$attrs.class]),style:ye(a(J))},[p.value?S(e.$slots,"error",{key:0},()=>[O("div",{class:g(a(o).e("error"))},ve(a(q)("el.image.error")),3)]):(i(),d(T,{key:1},[w.value!==void 0?(i(),d("img",pe({key:0},a(D),{src:w.value,loading:e.loading,style:a(Q),class:a(G),onClick:ee,onLoad:V,onError:W}),null,16,H)):m("v-if",!0),r.value?(i(),d("div",{key:1,class:g(a(o).e("wrapper"))},[S(e.$slots,"placeholder",{},()=>[O("div",{class:g(a(o).e("placeholder"))},null,2)])],2)):m("v-if",!0)],64)),a(k)?(i(),d(T,{key:2},[h.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",K,[S(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{A as E,Ce as __tla};
